On Monday 11 August 2008 15:39, [EMAIL PROTECTED] wrote:
> Author: nextgens
> Date: 2008-08-11 14:39:46 +0000 (Mon, 11 Aug 2008)
> New Revision: 21748
> 
> Modified:
>    trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
>    trunk/freenet/src/freenet/node/NodeIPDetector.java
>    trunk/freenet/src/freenet/pluginmanager/PluginInfoWrapper.java
>    trunk/freenet/src/freenet/pluginmanager/PluginManager.java
> Log:
> Skip the bandwidth limiting step in the wizard if the node has detected a 
recent enough, and working UPnP plugin
> 
> Modified: trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
> ===================================================================
> --- trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java        
2008-08-11 14:33:18 UTC (rev 21747)
> +++ trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java        
2008-08-11 14:39:46 UTC (rev 21748)
> @@ -114,6 +115,7 @@
>                       HTMLNode bandwidthForm = 
ctx.addFormChild(bandwidthInfoboxContent, ".", "bwForm");
>                       HTMLNode result = bandwidthForm.addChild("select", 
> "name", "bw");
>                       
> +                     // don't forget to update handlePost too if you change 
> that!
>                       result.addChild("option", "value", "8K", 
> l10n("bwlimitLowerSpeed"));
>                       // Special case for 128kbps to increase performance at 
> the cost of some 
link degradation. Above that we use 50% of the limit.
>                       result.addChild("option", "value", "12K", "512+/128 
> kbps");
> @@ -307,17 +309,28 @@
>                       } catch (InvalidConfigValueException e) {
>                               Logger.error(this, "Should not happen, please 
> report!" + e, e);
>                       }
> -                     super.writeTemporaryRedirect(ctx, "step3", 
TOADLET_URL+"?step="+WIZARD_STEP.BANDWIDTH);
> +                     
> +                     // Attempt to skip one step if possible

We should still display this step, but show the detected defaults.

> +                     FredPluginBandwidthIndicator bwIndicator = 
core.node.ipDetector.getBandwidthIndicator();
> +                     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)
> +                                     _setUpstreamBandwidthLimit("8K");
> +                             else if(upstreamBWLimit < 256000)
> +                                     _setUpstreamBandwidthLimit("12K");
> +                             else if(upstreamBWLimit < 512000)
> +                                     _setUpstreamBandwidthLimit("32K");
> +                             else if(upstreamBWLimit < 1024000)
> +                                     _setUpstreamBandwidthLimit("64K");
> +                             else
> +                                     _setUpstreamBandwidthLimit("1000K");
> +                             super.writeTemporaryRedirect(ctx, "step4", 
TOADLET_URL+"?step="+WIZARD_STEP.DATASTORE_SIZE);

It would be better to just convert it into bytes and take half of it, with 
some special handling for low values.

Also, we should use the downstream limit too, on the same principle.

> +                     } else
> +                             super.writeTemporaryRedirect(ctx, "step3", 
TOADLET_URL+"?step="+WIZARD_STEP.BANDWIDTH);
>                       return;

Attachment: pgpqpuyg024J1.pgp
Description: PGP signature

_______________________________________________
Devl mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl

Reply via email to