Author: nextgens
Date: 2008-08-12 16:39:59 +0000 (Tue, 12 Aug 2008)
New Revision: 21769

Modified:
   trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
Log:
round the value to prevent problems in the config framework

Modified: trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java  
2008-08-12 16:19:05 UTC (rev 21768)
+++ trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java  
2008-08-12 16:39:59 UTC (rev 21769)
@@ -315,14 +315,14 @@
                        int upstreamBWLimit = (bwIndicator != null ? 
bwIndicator.getUpstramMaxBitRate() : -1);
                        if((bwIndicator != null) && (upstreamBWLimit > 0)) {
                                int bytes = (upstreamBWLimit / 8) - 1;
-                               String upstreamBWLimitString = (bytes < 16384 ? 
"8K" : SizeUtil.formatSize(bytes / 2));
+                               String upstreamBWLimitString = (bytes < 16384 ? 
"8K" : SizeUtil.formatSize(Math.round(bytes / 2)));
                                
_setUpstreamBandwidthLimit(upstreamBWLimitString);
                                Logger.normal(this, "The node has a 
bandwidthIndicator: it has reported upstream="+upstreamBWLimit+ "bits/sec... we 
will use "+ upstreamBWLimitString +" and skip the bandwidth selection step of 
the wizard.");

                                int downstreamBWLimit = 
bwIndicator.getDownstreamMaxBitRate();
                                if(downstreamBWLimit > 0) {
                                        bytes = (downstreamBWLimit / 8) - 1;
-                                       String downstreamBWLimitString = 
SizeUtil.formatSize(bytes * 2/3);
+                                       String downstreamBWLimitString = 
SizeUtil.formatSize(Math.round(bytes * 2/3));
                                        
_setDownstreamBandwidthLimit(downstreamBWLimitString);
                                        Logger.normal(this, "The node has a 
bandwidthIndicator: it has reported downstream="+downstreamBWLimit+ 
"bits/sec... we will use "+ downstreamBWLimitString +" and skip the bandwidth 
selection step of the wizard.");
                                }


Reply via email to