First, background. I had heard some conversation on irc regarding 'sharing currently disabled' appearing when gnet bandwidth limit was equal to http bandwidth limit as ultrapeer, despite plenty of available bandwidth and slots.

Looking into this, I found the code in uploads.c will trigger this condition if the available bandwidth (bsched_bwps(bws.out)) is less than 256.

Looking into bsched to find how this was set my eyes were drawn to the following code (lines 312-328; not that it only effects ultrapeers):
steal = MIN(bw_http_in, bw_gnet_lin);
if (bws_glin_enabled && steal) {
bsched_set_bandwidth(bws.glin, steal);
bsched_set_bandwidth(bws.in, MAX(1, bw_http_in - steal));
} else {
bsched_set_bandwidth(bws.glin, 0); /* Disables */
bsched_set_bandwidth(bws.in, bw_http_in);
}


                steal = MIN(bw_http_out, bw_gnet_lout);
                if (bws_glout_enabled && steal) {
                        bsched_set_bandwidth(bws.glout, steal);
                        bsched_set_bandwidth(bws.out, MAX(1, bw_http_out - steal));
                } else {
                        bsched_set_bandwidth(bws.glout, 0);                     /* 
Disables */
                        bsched_set_bandwidth(bws.out, bw_http_out);
                }

I believe the problem here is that bws.out ends up set to 1 if both are equal. (I kind of confirmed by changing 1 to 256 and causing the scenario again. No bugs so far, and bandwidth stealing seems to still behave reasonably.)

I would just leave it at that, but I kind of suspect the above code is a little simplistic (as well as my fix), and could work better, so I thought I'd include the code too. (changing it so the MAX() can't come out < 256 may fix it; I don't know the code well enough...)

Peace,
Clayton

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Gtk-gnutella-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/gtk-gnutella-devel

Reply via email to