Author Topic: Request :: How To :: Get a table of all the current users objects  (Read 3137 times)

0 Members and 1 Guest are viewing this topic.

Offline Corayzon

  • Lord
  • ***
  • Posts: 464
  • Karma: +1/-0
um...im looking at adding a disconnectdoubleips feature to cslave but have found that i cant get a table of the current user objects.

I have played around with the idea but cant figure how to do this...and i dont want to resort to saving ips in another table.

please help


PtokaX forum


Offline HaArD

  • Double Ace
  • *
  • Posts: 104
  • Karma: +2/-1
(No subject)
« Reply #1 on: 12 May, 2004, 05:06:44 »
Corayzon,

I know... it's something that is seriously lacking in the ptokax script capabilities....

The best you can do is monitor Connections and Exits to build your own table.

Remember to include some code to save the table in the event that your script is reset while running.

....and help me lobby Ptazcek to include something to address this in .330!!!  8)  

It doesn't make sense for scripts to work so hard to re-create something that PtokaX already has stored in memory.... even access to the NickList string sent to connecting clients would be better then manually building the online users table via script connection/exit events.
« Last Edit: 12 May, 2004, 05:07:21 by HaArD »

Offline Corayzon

  • Lord
  • ***
  • Posts: 464
  • Karma: +1/-0
(No subject)
« Reply #2 on: 12 May, 2004, 05:11:00 »
hmmm...damb it...

all we need is a reference to the users table...ill just wait until this is added before i write the new feature...cause i really dont like rebuilding tables...

my script is about being effiecent on memory and on the processor to creat a fast relyable server that doesnt get killed with a userlist of 1000 users

thankz for info HaArD =]

Offline kp

  • Junior Member
  • **
  • Posts: 16
  • Karma: +0/-0
(No subject)
« Reply #3 on: 12 May, 2004, 09:42:28 »
i'd say it depends on how ptokax is able to pass on the table if you only can get a table where the index is not the IP, then you would have to loop over the whole table to check for double ip's, thats whats holds up, compared to that having a table with ip's as index is much more efficient.

Offline Corayzon

  • Lord
  • ***
  • Posts: 464
  • Karma: +1/-0
(No subject)
« Reply #4 on: 12 May, 2004, 10:05:14 »
tru dat! thankz for insight kp =]

Offline NotRabidWombat

  • Lord
  • ***
  • Posts: 384
  • Karma: +2/-0
(No subject)
« Reply #5 on: 12 May, 2004, 15:54:05 »
"i'd say it depends on how ptokax is able to pass on the table if you only can get a table where the index is not the IP, then you would have to loop over the whole table to check for double ip's, thats whats holds up, compared to that having a table with ip's as index is much more efficient."

That table would never work effectively since more than one person can have an IP. The most efficient way (and PtokaX uses it) is an array that reuses indexes. So SocketID directly corresponds to array index, voila instant index. The only problem is ConnectToMe, To, etc. If only DC Protocol used IDs rather than nicks.

*grumbles something about VB programmers*

The other problem is you can not simply give Lua a reference to an array in C/C++. You would have to push it onto the stack.

Even if you did get the user lists into a lua script, how could you guarentee that list is accurate when assyncronous events are occuring? So thread safety also becomes an issue.

Maybe if you re-examine the problem you want to solve with a list of users, you can find a better method to achieve a solution.

*EDIT* - I just reread the others post. disconnectdoubleips? That is useless. Even IF someone is cloning, it just means they've opened more slots so more people can download from them.

-NotRabidWombat
« Last Edit: 12 May, 2004, 15:57:00 by NotRabidWombat »


I like childish behavior. Maybe this post will be deleted next.

[NL]Pur

  • Guest
(No subject)
« Reply #6 on: 12 May, 2004, 16:05:35 »
well i think the main reason why you want to prevent this, is because you have for example 100 as max users, and if someone is twice logged in with same share then you're hub is missing some share of 1 user.

Offline NotRabidWombat

  • Lord
  • ***
  • Posts: 384
  • Karma: +2/-0
(No subject)
« Reply #7 on: 12 May, 2004, 17:04:25 »
Well, then that should be a task left up to an operator tool, since only a match on the filelist should imply that it is the same user.

MANY users are behind subnets.

-NotRabidWombat


I like childish behavior. Maybe this post will be deleted next.

[NL]Pur

  • Guest
(No subject)
« Reply #8 on: 12 May, 2004, 18:11:05 »
indeed so it should be solved on clientside, bcdc maybe...

Offline Corayzon

  • Lord
  • ***
  • Posts: 464
  • Karma: +1/-0
(No subject)
« Reply #9 on: 13 May, 2004, 08:54:46 »
as i read through i get some good ideas....thankz guyz!

Herodes

  • Guest
(No subject)
« Reply #10 on: 07 July, 2004, 00:39:16 »
I came across the same thought as Corayzon,
I found this thread ... I was wondering if u did write code for something like this or not ..?
"I need it big time"... :P  
!me is trying to do something parrallel to that ...
is there any piece of work we can look at ? :D

Offline Corayzon

  • Lord
  • ***
  • Posts: 464
  • Karma: +1/-0
(No subject)
« Reply #11 on: 07 July, 2004, 01:34:45 »
hey all,

sinse i posted this i have grown alot in my scripting and way of thinking to proform better, ...

Depending on what u wanna do, this can be done.

The first way is to store tables of usernames. When a user connects get the usertable and save it to your usertable. This takes up 2 times memory on user objects.

Another way is to just have a username list, and when needed have the script compile the userobjects together... but his is just as bad as above.

The truth is the most effective way to do this is based on what ya wanna do!

in the first post, i say ip checking, and as HaArD pointed out. The best way is to save these to a table like ["ip"] = sUsername and on $Key just do if tIPs[tUser.sIP] then.

neways im gonna shutup =]

hehe, noza

Herodes

  • Guest
(No subject)
« Reply #12 on: 07 July, 2004, 21:39:25 »
thanks for sharing the light Corayzon ...
I think I'll take this one to the ImprintToBrainMem(Herodes, Corayzon.data)
:D:D:D

PtokaX forum

(No subject)
« Reply #12 on: 07 July, 2004, 21:39:25 »