From e2d7b1a2cf9f9f67e3c835b8b97ca97fde94c5c0 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sat, 12 Apr 2025 11:54:58 +0200 Subject: always close obfspvn client first, then stop running openvpn process --- .../main/java/de/blinkt/openvpn/core/OpenVPNService.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 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 1ed7bc39..1cfb2c27 100644 --- a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java +++ b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java @@ -378,13 +378,6 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac Connection connection = mProfile.mConnections[0]; VpnStatus.setCurrentlyConnectingProfile(mProfile); - // Set a flag that we are starting a new VPN - mStarting = true; - // Stop the previous session by interrupting the thread. - stopOldOpenVPNProcess(); - // An old running VPN should now be exited - mStarting = false; - // stop old running obfsvpn client if (!stopObfsvpn()) { VpnStatus.logError("Failed to stop already running obfsvpn client"); @@ -392,6 +385,13 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac return; } + // Set a flag that we are starting a new VPN + mStarting = true; + // Stop the previous session by interrupting the thread. + stopOldOpenVPNProcess(); + // An old running VPN should now be exited + mStarting = false; + // optionally start start obfsvpn and adapt openvpn config to the port obfsvpn is listening to Connection.TransportType transportType = connection.getTransportType(); if (mProfile.usePluggableTransports() && transportType.isPluggableTransport()) { -- cgit v1.2.3