1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2024-12-22 07:43:15 +00:00

Removed VPN handover

There are just too many problems with this
This commit is contained in:
M66B 2019-06-29 18:50:36 +02:00
parent a32a18ec78
commit 848667885e

View file

@ -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);
}
}
}