コード例 #1
0
  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());
      }
    }
  }
コード例 #2
0
  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();
  }
コード例 #3
0
 public int getMaxUploadSpeed() {
   return (provider.getMaxUploadSpeed());
 }
コード例 #4
0
 /**
  * Returns the current view of when choking occurs
  *
  * @return speed in bytes/sec
  */
 public int getCurrentChokeSpeed() {
   return (provider.getCurrentChokeSpeed());
 }
コード例 #5
0
 public int getMaxPingMillis() {
   return (provider.getMaxPingMillis());
 }
コード例 #6
0
 public int getCurrentPingMillis() {
   return (provider.getCurrentPingMillis());
 }
コード例 #7
0
 public int getIdlePingMillis() {
   return (provider.getIdlePingMillis());
 }