Hello,

I've been using gtk-gnutella for some time now and am subscribed to the developers' list. First of all many thanks to everyone for such a great program.

Now I recently found some minor issues with the program and would like to point them out to the list for suggestions. I would gladly try to code some fixes if the list believes these are problems, OR if I misread the code please correct me.

First the symptom,

I'm in one of those "degraded" network locations (Puerto Rico to be exact ;) , it appears that some of my ISP's upstream connections are filtered for ports 6346:6348, so I end up with a lot of timeout connections as most other clients still default to those ports. Grr! I can be sure that not all uplinks are filtered since I sometimes do get a connection to a host using that port.

The main problem is during startup, I usually need to wait an hour or more to be able to get 2-3 ultrapeers. At one time even after eight hours I still didn't have a single stable ultrapeer connection. So the situation is quite bad.

Following the code I believe this is what gtk-gnutella does to get (ultra)peer connections,

1. Get a hold of a gwcache and get hosts from there (also load up the prev. host cache)

2. if connections < desired get a host from either the pong cache or host cache and try to connect. This takes the host out of the host cache.

3. If the connection fails gtk forgets the host (the entry is deleted)

4. While we have less that optimal number of hosts hit the gwcache for more hosts (this will usually be triggered since we are removing hosts from the host cache to connect to them)

5. Goto 2 (until we have enough connections)

If this is correct, I see a few problems here,

1. First we are probably hammering the web cache if we don't connect quickly enough to some ultrapeers (one query per sec. I believe)

2. The web cache will likely return the same hosts again and again, these will be added back to the host cache and deleted when we attempt to connect, but will likely not increase our chances of connecting.

3. The huge list of hosts we accumulate (~20k) doesn't get used up since we keep adding more (the same) hosts from the web cache to the end of the list and we take from the end of the list to attempt our connections.

I've seen this happen, I've seen the same 20-40 hosts scroll up the Gnutella network pane with failed connections while the amount of hosts in the host cache remains about the same (first it goes down, the gets repopulated by the web cache)

Possible solutions,

First the easy ones, regrettably I've already tried and they help but not much:

1> store the time of the last hit to the webcache and don't hit again until some reasonable amount of time has elapsed, say 2-5 minutes? This forces gtk-gnutella to eat up some of those unreachable hosts in the cache, hopefully hitting a good host in the process.

2> hop around the web cache list, after a hit to a cache, hit another URL the next time.

3> every other time we seek a host from the host cache, take it from the head of the list instead of the tail. So again we eat up the unreachable / stale hosts and perhaps hit a good ole' one.

I had some code that did this already (sans #3) but lost it when I resync'ed to the CVS to make sure I hadn't screwed anything up. I can probably code it again easily.

What I believe would be the right (and hard) way to do this is to keep some state on the hosts we attempt to connect and fail (from timeout or connection refused, not from host full, etc). When we get that host again from a pong or web cache skip it unless some retry timeout has elapsed.

I guess the best way to do this would be to use the support for unstable hosts that's already built-in and add an additional flag to signal a so-far-unreachable host.

What do you think? It would probably help everyone by providing faster connects to gnutella, not just those with bad connections, and keeping a cleaner host cache.

I can provide patches for the first suggestions, and start working on the last one if you agree with me.

Cheers,

-Rafael

---
Rafael R. Reilova




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Gtk-gnutella-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/gtk-gnutella-devel

Reply via email to