diff options
author | cyBerta <cyberta@riseup.net> | 2022-06-26 19:10:45 +0200 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2022-07-19 00:03:56 +0200 |
commit | e23a3bf428ce8e99c55746a2cc267e0a3a5b96d3 (patch) | |
tree | edf7cccc30dce4eec94c43a3fc7a4a1af24ea996 | |
parent | 0fef9e2e19ccc77456a66f4f174b1fea94c1260f (diff) |
restart obfsvpn proxy on reconnects or when connecting to new gateways
-rw-r--r-- | app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java | 11 |
1 files changed, 6 insertions, 5 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 6edbbab4..e4323b6c 100644 --- a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java +++ b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java @@ -244,7 +244,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac if (shapeshifter != null) { shapeshifter.stop(); shapeshifter = null; - } else if (obfsVpnClient != null) { + } else if (obfsVpnClient != null && obfsVpnClient.isStarted()) { obfsVpnClient.stop(); obfsVpnClient = null; } @@ -419,10 +419,11 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac if (mProfile.mUsePluggableTransports && connection instanceof Obfs4Connection) { Obfs4Connection obfs4Connection = (Obfs4Connection) connection; if (BuildConfig.use_obfsvpn) { - if (obfsVpnClient == null) { - obfsVpnClient = new ObfsVpnClient(obfs4Connection.getDispatcherOptions()); - obfsVpnClient.start(); + if (obfsVpnClient != null && obfsVpnClient.isStarted()) { + obfsVpnClient.stop(); } + obfsVpnClient = new ObfsVpnClient(obfs4Connection.getDispatcherOptions()); + obfsVpnClient.start(); } else if (shapeshifter == null) { shapeshifter = new Shapeshifter(obfs4Connection.getDispatcherOptions()); shapeshifter.start(); @@ -485,7 +486,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac Log.d(TAG, "-> stop shapeshifter"); shapeshifter.stop(); shapeshifter = null; - } else if (obfsVpnClient != null) { + } else if (obfsVpnClient != null && obfsVpnClient.isStarted()) { Log.d(TAG, "-> stop obfsvpnClient"); obfsVpnClient.stop(); obfsVpnClient = null; |