Author: toad
Date: 2008-04-25 22:49:27 +0000 (Fri, 25 Apr 2008)
New Revision: 19564

Modified:
   trunk/freenet/src/freenet/node/NodeStats.java
Log:
Turn last-resort high level throttle limiting back on.

Modified: trunk/freenet/src/freenet/node/NodeStats.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeStats.java       2008-04-25 22:48:04 UTC 
(rev 19563)
+++ trunk/freenet/src/freenet/node/NodeStats.java       2008-04-25 22:49:27 UTC 
(rev 19564)
@@ -592,27 +592,27 @@
                        return "Input bandwidth liability 
("+bandwidthLiabilityInput+" > "+bandwidthAvailableInput+")";
                }

-//             // Do we have the bandwidth?
-//             double expected = this.getThrottle(isLocal, isInsert, isSSK, 
true).currentValue();
-//             int expectedSent = (int)Math.max(expected / overheadFraction, 
0);
-//             if(logMINOR)
-//                     Logger.minor(this, "Expected sent bytes: "+expected+" 
-> "+expectedSent);
-//             if(!requestOutputThrottle.instantGrab(expectedSent)) {
-//                     pInstantRejectIncoming.report(1.0);
-//                     rejected("Insufficient output bandwidth", isLocal);
-//                     return "Insufficient output bandwidth";
-//             }
-//             expected = this.getThrottle(isLocal, isInsert, isSSK, 
false).currentValue();
-//             int expectedReceived = (int)Math.max(expected, 0);
-//             if(logMINOR)
-//                     Logger.minor(this, "Expected received bytes: 
"+expectedReceived);
-//             if(!requestInputThrottle.instantGrab(expectedReceived)) {
-//                     requestOutputThrottle.recycle(expectedSent);
-//                     pInstantRejectIncoming.report(1.0);
-//                     rejected("Insufficient input bandwidth", isLocal);
-//                     return "Insufficient input bandwidth";
-//             }
-//
+               // Do we have the bandwidth?
+               double expected = this.getThrottle(isLocal, isInsert, isSSK, 
true).currentValue();
+               int expectedSent = (int)Math.max(expected / overheadFraction, 
0);
+               if(logMINOR)
+                       Logger.minor(this, "Expected sent bytes: "+expected+" 
-> "+expectedSent);
+               if(!requestOutputThrottle.instantGrab(expectedSent)) {
+                       pInstantRejectIncoming.report(1.0);
+                       rejected("Insufficient output bandwidth", isLocal);
+                       return "Insufficient output bandwidth";
+               }
+               expected = this.getThrottle(isLocal, isInsert, isSSK, 
false).currentValue();
+               int expectedReceived = (int)Math.max(expected, 0);
+               if(logMINOR)
+                       Logger.minor(this, "Expected received bytes: 
"+expectedReceived);
+               if(!requestInputThrottle.instantGrab(expectedReceived)) {
+                       requestOutputThrottle.recycle(expectedSent);
+                       pInstantRejectIncoming.report(1.0);
+                       rejected("Insufficient input bandwidth", isLocal);
+                       return "Insufficient input bandwidth";
+               }
+
                if(source != null) {
                        if(source.getMessageQueueLengthBytes() > 
MAX_PEER_QUEUE_BYTES) {
                                rejected(">MAX_PEER_QUEUE_BYTES", isLocal);


Reply via email to