How to tell which hub a certain user is on?

Technical discussion about the NMDC and <a href="http://dcpp.net/ADC.html">ADC</A> protocol. The NMDC protocol is documented in the <a href="http://dcpp.net/wiki/">Wiki</a>, so feel free to refer to it.

Moderator: Moderators

Locked
xayide
Posts: 21
Joined: 2003-06-12 09:38

How to tell which hub a certain user is on?

Post by xayide » 2003-06-24 06:59

Hello,

I am programming an CDM and I have a fucntion that collects users IP/lock/pk and lots of more info. Problem is the same as for normal downloads. DC++ cant know which user is connecting to me when I sent them an CTM. Same as for downloads.EX:

U have queueed a file and u are connected to at least two hubs where there are users with the same nicks. DC++ will always try to download the file from the first hub because getUser() always returns the first hit.

This is the same problem I have when I want to store ppls lock/pk/ip.
Anyone have any good solution for it? Or at least some ideas?
You can always reach me nowhere!

sarf
Posts: 382
Joined: 2003-01-24 05:43
Location: Sweden
Contact:

Post by sarf » 2003-06-24 09:56

Extend the getUser() method with parameters (default set to NULL or something, so that you don't break the code that uses the old getUser() method). For example, checking for a user in a certain hub should work well (use either a string or a char array, and check both IP and address).

If you manage to do this, please publish the code - I want to do this in my share-checker as well.

Sarf
---
I'd rather have a bottle in front of me than a frontal lobotomy.

xayide
Posts: 21
Joined: 2003-06-12 09:38

Post by xayide » 2003-06-24 10:15

Problem is how to to know which user is connecting. Ihave one little idea:

After u have sent CTM to him register which user u sent CTM to and only put the new information to the next nick in the list that doestn have the flag set.

pros:
U can check if the BOOL is not set and iterate through the list till u find the first user with that nick that doesnt have the BOOL set. And that should probably be the right user.

Cons:
If the first user u sent CTM to didnt answer u will put the wrong data to the wrong guy if u send CTM to anothe user witht the same nick while the first didnt answer.
You can always reach me nowhere!

sarf
Posts: 382
Joined: 2003-01-24 05:43
Location: Sweden
Contact:

Post by sarf » 2003-06-25 11:08

If you wish to make it your way, simply insert the current tick in a field when you add someone to the CTM list and get the most recently "wanted" user instead. It should be somewhat safer.

Sarf
---
I like winter. I like the cold. I like the sound of flowers dying.

xayide
Posts: 21
Joined: 2003-06-12 09:38

Post by xayide » 2003-06-25 11:53

Yeah thats the way I intend to do it. As I already have a timeout for each user that tells the collection function to retry the user after 120 secs.
So I already add a Get_tick() into a variable on the user on theyre entry to the hub. SO they wont be Collected until they have been in the hub for at least 30 secs...

Anyhow did u have any other solution? I think we got the same problem if u check fakeshares the way I told u.
You can always reach me nowhere!

sarf
Posts: 382
Joined: 2003-01-24 05:43
Location: Sweden
Contact:

Post by sarf » 2003-06-25 13:50

I would make DC++ use the hint it can be given to get the "most likely hub"-user first... unfortunately, as I see now, this is not possible with onLock().

A list of user which are to give up their locks / pks should suffice - and have a secondary list containing "duplicate users" so that any nick can only be used once in the "incoming connection list". Note: this means that you have to delay issuing CTMs to the duplicate users.

Sarf
---
Until, one by one... HE DESTROYED THEM ALL!

ivulfusbar
Posts: 506
Joined: 2003-01-03 07:33

Post by ivulfusbar » 2003-06-26 02:04

there is another rather simple solution which might not be the prettiest. Use differents ports, then you can make sure which user it is.
Everyone is supposed to download from the hubs, - I don´t know why, but I never do anymore.

xayide
Posts: 21
Joined: 2003-06-12 09:38

Post by xayide » 2003-06-26 02:18

Fusbar yes its true. But that solution isnt really as simple as it sounds. I have to redo some of the code in the Bufferedsocket to do this. If I made it this way I would tag all hubs with a counter. Then have the configured + hubcount as the cincomming port for the partciualar hubuser. in such way I dont have to bother if two users with the same nick connects at the same time, just subtract the configureds port from the incomming port. and u have the hub the user isomming from.
You can always reach me nowhere!

xayide
Posts: 21
Joined: 2003-06-12 09:38

Post by xayide » 2003-06-26 10:27

I give up for a while. Didnt succed in my new getUser function..

:-(
You can always reach me nowhere!

Locked