summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2021-06-24 23:22:00 +0200
committercyBerta <cyberta@riseup.net>2021-07-21 22:02:24 +0200
commit6f0e9019fcccac9ae5edbaadd91915cb32c867da (patch)
treed0c4a09c6613890624a606ca5ec99437fd848c02
parent236c17ec3f4348a9f0d4ec4a2454b9fbfaf8707f (diff)
Stop tor proxy if provider api communication failed. Proxy will be reinitiated on next api call
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java b/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java
index 45c829b6..f42a7d3d 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/EipSetupObserver.java
@@ -68,7 +68,11 @@ import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PROFILE;
import static se.leap.bitmaskclient.providersetup.ProviderAPI.CORRECTLY_DOWNLOADED_EIP_SERVICE;
import static se.leap.bitmaskclient.providersetup.ProviderAPI.CORRECTLY_DOWNLOADED_GEOIP_JSON;
import static se.leap.bitmaskclient.providersetup.ProviderAPI.CORRECTLY_UPDATED_INVALID_VPN_CERTIFICATE;
+import static se.leap.bitmaskclient.providersetup.ProviderAPI.INCORRECTLY_DOWNLOADED_EIP_SERVICE;
import static se.leap.bitmaskclient.providersetup.ProviderAPI.INCORRECTLY_DOWNLOADED_GEOIP_JSON;
+import static se.leap.bitmaskclient.providersetup.ProviderAPI.INCORRECTLY_DOWNLOADED_VPN_CERTIFICATE;
+import static se.leap.bitmaskclient.providersetup.ProviderAPI.INCORRECTLY_UPDATED_INVALID_VPN_CERTIFICATE;
+import static se.leap.bitmaskclient.providersetup.ProviderAPI.PROVIDER_NOK;
import static se.leap.bitmaskclient.providersetup.ProviderAPI.STOP_PROXY;
import static se.leap.bitmaskclient.tor.TorStatusObservable.TorStatus.OFF;
@@ -202,6 +206,13 @@ public class EipSetupObserver extends BroadcastReceiver implements VpnStatus.Sta
case INCORRECTLY_DOWNLOADED_GEOIP_JSON:
maybeStartEipService(resultData);
break;
+ case PROVIDER_NOK:
+ case INCORRECTLY_UPDATED_INVALID_VPN_CERTIFICATE:
+ case INCORRECTLY_DOWNLOADED_EIP_SERVICE:
+ case INCORRECTLY_DOWNLOADED_VPN_CERTIFICATE:
+ if (TorStatusObservable.getStatus() != OFF) {
+ ProviderAPICommand.execute(context.getApplicationContext(), STOP_PROXY, null);
+ }
default:
break;
}