Commit 70a9324d authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃
Browse files

fixup! Bug 40597: Implement TorSettings module

Bug 41114: Refactor TorConnect.

When simulating censorship, do not trigger an additional change of state
if one is already happening.
parent 60bb10be
Loading
Loading
Loading
Loading
+18 −10
Original line number Diff line number Diff line
@@ -382,6 +382,10 @@ class BootstrappingState extends StateCallback {
    }

    await debugSleep(1500);
    if (this.transitioning) {
      // Already left this state.
      return true;
    }
    TorConnect._hasBootstrapEverFailed = true;
    if (censorshipLevel === 2) {
      const codes = Object.keys(TorConnect._countryNames);
@@ -453,11 +457,13 @@ class AutoBootstrappingState extends StateCallback {
    // location specific settings.
    if (censorshipLevel === 3) {
      await debugSleep(2500);
      if (!this.transitioning) {
        this.changeState(
          TorConnectState.Error,
          "Error: censorship simulation",
          ""
        );
      }
      return true;
    }

@@ -465,11 +471,13 @@ class AutoBootstrappingState extends StateCallback {
    // manually selecting a country.
    if (censorshipLevel === 2 && !countryCode) {
      await debugSleep(2500);
      if (!this.transitioning) {
        this.changeState(
          TorConnectState.Error,
          "Error: Severe Censorship simulation",
          ""
        );
      }
      return true;
    }