diff options
author | cyBerta <cyberta@riseup.net> | 2019-10-30 00:04:39 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2019-10-30 00:04:39 +0100 |
commit | 7cb2f52e809a72201cfd3444166c500946de2e71 (patch) | |
tree | 6c4479873b0f5397c26001bc04902493be406b6a /app | |
parent | a391957c8181f7f4b651ac4c35d2dc6ac8223700 (diff) |
make sure shapeshifter dispatcher is stopped between switching vpn processes
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java index 2c4462e0..0863cc8e 100644 --- a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java +++ b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java @@ -248,6 +248,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac if (!replaceConnection) { if (shapeshifter != null) { shapeshifter.stop(); + shapeshifter = null; } VpnStatus.updateStateString("NOPROCESS", "VPN STOPPED", R.string.state_noprocess, ConnectionStatus.LEVEL_NOTCONNECTED); } @@ -255,14 +256,8 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac } return false; } else { - if (!replaceConnection) { - if (shapeshifter != null) { - shapeshifter.stop(); - } - VpnStatus.updateStateString("NOPROCESS", "VPN STOPPED", R.string.state_noprocess, ConnectionStatus.LEVEL_NOTCONNECTED); - return true; - } - return false; + VpnStatus.updateStateString("NOPROCESS", "VPN STOPPED", R.string.state_noprocess, ConnectionStatus.LEVEL_NOTCONNECTED); + return true; } } @@ -384,12 +379,6 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac Connection connection = mProfile.mConnections[0]; - if (mProfile.mUsePluggableTransports) { - Obfs4Connection obfs4Connection = (Obfs4Connection) connection; - shapeshifter = new Shapeshifter(obfs4Connection.getDispatcherOptions()); - shapeshifter.start(); - } - VpnStatus.logInfo(R.string.building_configration); VpnStatus.updateStateString("VPN_GENERATE_CONFIG", "", R.string.building_configration, ConnectionStatus.LEVEL_START); @@ -414,6 +403,14 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac // An old running VPN should now be exited mStarting = false; + if (mProfile.mUsePluggableTransports) { + Obfs4Connection obfs4Connection = (Obfs4Connection) connection; + if (shapeshifter == null) { + shapeshifter = new Shapeshifter(obfs4Connection.getDispatcherOptions()); + shapeshifter.start(); + } + } + // Start a new session by creating a new thread. boolean useOpenVPN3 = VpnProfile.doUseOpenVPN3(this); @@ -460,11 +457,17 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac } private void stopOldOpenVPNProcess() { + Log.d(TAG, "stopOldVPNProcess"); if (mManagement != null) { if (mOpenVPNThread != null) ((OpenVPNThread) mOpenVPNThread).setReplaceConnection(); if (mManagement.stopVPN(true)) { // an old was asked to exit, wait 1s + if (shapeshifter != null) { + Log.d(TAG, "-> stop shapeshifter"); + shapeshifter.stop(); + shapeshifter = null; + } try { Thread.sleep(1000); } catch (InterruptedException e) { |