From 848667885e79514cc65d0479421ca1ab18dd93a8 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 29 Jun 2019 18:50:36 +0200 Subject: [PATCH] Removed VPN handover There are just too many problems with this --- .../eu/faircode/netguard/ServiceSinkhole.java | 26 ++++--------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/eu/faircode/netguard/ServiceSinkhole.java b/app/src/main/java/eu/faircode/netguard/ServiceSinkhole.java index 304cd7af..84c6ff02 100644 --- a/app/src/main/java/eu/faircode/netguard/ServiceSinkhole.java +++ b/app/src/main/java/eu/faircode/netguard/ServiceSinkhole.java @@ -571,28 +571,12 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS last_builder = builder; Log.i(TAG, "VPN restart"); - // Attempt seamless handover - ParcelFileDescriptor prev = vpn; + if (vpn != null){ + stopNative(vpn, clear); + stopVPN(vpn); + } + vpn = startVPN(builder); - - if (prev != null && vpn == null) { - Log.w(TAG, "Handover failed"); - stopNative(prev, clear); - stopVPN(prev); - prev = null; - try { - Thread.sleep(3000); - } catch (InterruptedException ignored) { - } - vpn = startVPN(last_builder); - if (vpn == null) - throw new IllegalStateException("Handover failed"); - } - - if (prev != null) { - stopNative(prev, clear); - stopVPN(prev); - } } }