summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java11
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;