Author: toad
Date: 2008-08-12 15:26:08 +0000 (Tue, 12 Aug 2008)
New Revision: 21763

Modified:
   trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
Log:
If bandwidth detected is over 16K, limit to half of the detected limit in bytes.


Modified: trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java  
2008-08-12 15:09:24 UTC (rev 21762)
+++ trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java  
2008-08-12 15:26:08 UTC (rev 21763)
@@ -315,16 +315,11 @@
                        int upstreamBWLimit = (bwIndicator != null ? 
bwIndicator.getUpstramMaxBitRate() : -1);
                        if((bwIndicator != null) && (upstreamBWLimit > 0)) {
                                Logger.normal(this, "The node has a 
bandwidthIndicator: it has reported "+upstreamBWLimit+ "... we will use that 
value and skip the bandwidth selection step of the wizard.");
-                               if(upstreamBWLimit < 128000)
+                               int bytes = upstreamBWLimit / 8;
+                               if(bytes < 16384)
                                        _setUpstreamBandwidthLimit("8K");
-                               else if(upstreamBWLimit < 256000)
-                                       _setUpstreamBandwidthLimit("12K");
-                               else if(upstreamBWLimit < 512000)
-                                       _setUpstreamBandwidthLimit("32K");
-                               else if(upstreamBWLimit < 1024000)
-                                       _setUpstreamBandwidthLimit("64K");
                                else
-                                       _setUpstreamBandwidthLimit("1000K");
+                                       
_setUpstreamBandwidthLimit(Integer.toString(bytes/2));
                                super.writeTemporaryRedirect(ctx, "step4", 
TOADLET_URL+"?step="+WIZARD_STEP.DATASTORE_SIZE);
                        } else
                                super.writeTemporaryRedirect(ctx, "step3", 
TOADLET_URL+"?step="+WIZARD_STEP.BANDWIDTH);


Reply via email to