From e23a3bf428ce8e99c55746a2cc267e0a3a5b96d3 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sun, 26 Jun 2022 19:10:45 +0200 Subject: restart obfsvpn proxy on reconnects or when connecting to new gateways --- app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'app/src') 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; -- cgit v1.2.3