Request :: How To :: Get a table of all the current users objects
 

Request :: How To :: Get a table of all the current users objects

Started by Corayzon, 12 May, 2004, 04:47:38

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Corayzon

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


HaArD

#1
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.

Corayzon

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 =]

kp

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.

Corayzon

tru dat! thankz for insight kp =]

NotRabidWombat

#5
"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


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

[NL]Pur

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.

NotRabidWombat

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

indeed so it should be solved on clientside, bcdc maybe...

Corayzon

as i read through i get some good ideas....thankz guyz!

Herodes

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

Corayzon

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

thanks for sharing the light Corayzon ...
I think I'll take this one to the ImprintToBrainMem(Herodes, Corayzon.data)
:D:D:D

SMF spam blocked by CleanTalk