Author: toad
Date: 2008-03-29 19:37:03 +0000 (Sat, 29 Mar 2008)
New Revision: 18846

Modified:
   trunk/freenet/src/freenet/node/NodeStats.java
Log:
Use the overhead fraction, don't subtract the overhead rate from the limit.

Modified: trunk/freenet/src/freenet/node/NodeStats.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeStats.java       2008-03-29 18:22:15 UTC 
(rev 18845)
+++ trunk/freenet/src/freenet/node/NodeStats.java       2008-03-29 19:37:03 UTC 
(rev 18846)
@@ -489,7 +489,10 @@
                        successfulChkOfferReplyBytesSentAverage.currentValue() 
* numCHKOfferReplies +
                        successfulSskOfferReplyBytesSentAverage.currentValue() 
* numSSKOfferReplies;
                double bandwidthAvailableOutput =
-                       (node.getOutputBandwidthLimit() - 
sentOverheadPerSecond) * 90; // 90 seconds at full power; we have to leave some 
time for the search as well
+                       // It's safer to use the fraction. If for some reason 
our output has been over the limit
+                       // for a while, (which we cannot entirely eliminate 
with the current code), doing it the
+                       // other way could produce a very low or even negative 
number.
+                       (node.getOutputBandwidthLimit() * overheadFraction) * 
90; // 90 seconds at full power; we have to leave some time for the search as 
well
                if(bandwidthLiabilityOutput > bandwidthAvailableOutput) {
                        pInstantRejectIncoming.report(1.0);
                        rejected("Output bandwidth liability", isLocal);


Reply via email to