From 2756ba844be7d434b5e1fe5632f484827c8f2cc3 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Thu, 20 Aug 2015 15:16:59 +0200 Subject: Fix logic when a network is temporary unavailable --- .../java/de/blinkt/openvpn/core/DeviceStateReceiver.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/main/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java b/main/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java index 240e9e32..f0acb6df 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java +++ b/main/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java @@ -219,24 +219,24 @@ public class DeviceStateReceiver extends BroadcastReceiver implements ByteCountL else sameNetwork = true; + /* Same network, connection still 'established' */ if (pendingDisconnect && sameNetwork) { mDisconnectHandler.removeCallbacks(mDelayDisconnectRunnable); // Reprotect the sockets just be sure mManagement.networkChange(true); - } + } else { + /* Different network or connection not established anymore */ - if (!sameNetwork) { if (screen == connectState.PENDINGDISCONNECT) screen = connectState.DISCONNECTED; if (shouldBeConnected()) { mDisconnectHandler.removeCallbacks(mDelayDisconnectRunnable); - if (lastNetwork == -1 && !pendingDisconnect) { - mManagement.resume(); - } else { - mManagement.networkChange(false); - } + if (pendingDisconnect) + mManagement.networkChange(false); + else + mManagement.resume(); } lastNetwork = newnet; -- cgit v1.2.3