From 7dc9f9e9caf41976d08c967d2d966648c99f929b Mon Sep 17 00:00:00 2001 From: cyBerta Date: Wed, 22 May 2019 20:28:08 +0200 Subject: * adds a DISCONNECTING state * fixes vpn startup issues --- .../de/blinkt/openvpn/core/OpenVPNService.java | 25 ++++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'app/src/main/java/de/blinkt/openvpn/core') 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 e42e36bb..af31e977 100644 --- a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java +++ b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java @@ -237,15 +237,22 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac } @Override - public boolean stopVPN(boolean replaceConnection) throws RemoteException { - if (getManagement() != null && getManagement().stopVPN(replaceConnection)) { - if (!replaceConnection) { - VpnStatus.updateStateString("NOPROCESS", "VPN STOPPED", R.string.state_noprocess, ConnectionStatus.LEVEL_NOTCONNECTED); - } - return true; - } else { - return false; - } + public boolean stopVPN(boolean replaceConnection) { + if(isVpnRunning()) { + if (getManagement() != null && getManagement().stopVPN(replaceConnection)) { + if (!replaceConnection) { + VpnStatus.updateStateString("NOPROCESS", "VPN STOPPED", R.string.state_noprocess, ConnectionStatus.LEVEL_NOTCONNECTED); + } + return true; + } + return false; + } else { + if (!replaceConnection) { + VpnStatus.updateStateString("NOPROCESS", "VPN STOPPED", R.string.state_noprocess, ConnectionStatus.LEVEL_NOTCONNECTED); + return true; + } + return false; + } } /** -- cgit v1.2.3