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?
How to tell which hub a certain user is on?
Moderator: Moderators
-
xayide
- Posts: 21
- Joined: 2003-06-12 14:38
How to tell which hub a certain user is on?
You can always reach me nowhere!
-
sarf
- Posts: 382
- Joined: 2003-01-24 10:43
- Location: Sweden
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.
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 14:38
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.
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 10:43
- Location: Sweden
-
xayide
- Posts: 21
- Joined: 2003-06-12 14:38
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.
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 10:43
- Location: Sweden
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!
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 12:33
-
xayide
- Posts: 21
- Joined: 2003-06-12 14:38
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!
Who is online
Users browsing this forum: Google [Bot] and 0 guests