protected void setEnabledSupport(boolean _enabled) { if (enabled != _enabled) { log("Enabled set to " + _enabled); if (_enabled) { original_limits = adapter.getLimits(); } else { ping_mapper.saveHistory(); } enableOrAlgChanged(); enabled = _enabled; if (speed_tester != null) { speed_tester.setContactNumber(enabled ? CONTACT_NUMBER : 0); } if (!enabled) { adapter.setLimits(original_limits, true, provider.getAdjustsDownloadLimits()); } } }
protected void enableOrAlgChanged() { total_contacts = 0; SpeedManagerAlgorithmProvider old_provider = provider; if (provider_version == 1) { if (!(provider instanceof SpeedManagerAlgorithmProviderV1)) { provider = new SpeedManagerAlgorithmProviderV1(this); } } else if (provider_version == 2) { if (!(provider instanceof SpeedManagerAlgorithmProviderV2)) { provider = new SpeedManagerAlgorithmProviderV2(this); } } else if (provider_version == 3) { provider = new SpeedManagerAlgorithmProviderV2(this); } else { Debug.out("Unknown provider version " + provider_version); if (!(provider instanceof nullProvider)) { provider = new nullProvider(); } } if (old_provider != provider) { log("Algorithm set to " + provider.getClass().getName()); } if (old_provider != null) { old_provider.destroy(); } provider.reset(); }
public int getMaxUploadSpeed() { return (provider.getMaxUploadSpeed()); }
/** * Returns the current view of when choking occurs * * @return speed in bytes/sec */ public int getCurrentChokeSpeed() { return (provider.getCurrentChokeSpeed()); }
public int getMaxPingMillis() { return (provider.getMaxPingMillis()); }
public int getCurrentPingMillis() { return (provider.getCurrentPingMillis()); }
public int getIdlePingMillis() { return (provider.getIdlePingMillis()); }