Author: toad
Date: 2008-04-28 17:32:36 +0000 (Mon, 28 Apr 2008)
New Revision: 19599

Modified:
   trunk/freenet/src/freenet/node/NodeStats.java
Log:
Avoid an integer overflow

Modified: trunk/freenet/src/freenet/node/NodeStats.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeStats.java       2008-04-28 17:10:36 UTC 
(rev 19598)
+++ trunk/freenet/src/freenet/node/NodeStats.java       2008-04-28 17:32:36 UTC 
(rev 19599)
@@ -585,7 +585,7 @@
                        
successfulSskOfferReplyBytesReceivedAverage.currentValue() * numSSKOfferReplies;
                }
                double bandwidthAvailableInput =
-                       node.getInputBandwidthLimit() * 90; // 90 seconds at 
full power
+                       (double)node.getInputBandwidthLimit() * 90; // 90 
seconds at full power; avoid integer overflow
                if(bandwidthAvailableInput < 0){
                        Logger.error(this, "Negative available bandwidth: 
"+bandwidthAvailableInput+" node.ibwlimit="+node.getInputBandwidthLimit()+" 
node.obwlimit="+node.getOutputBandwidthLimit()+" 
node.inputLimitDefault="+node.inputLimitDefault);
                }


Reply via email to