1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2025-03-10 14:14:31 +00:00

Fixed crash on stop (2)

This commit is contained in:
M66B 2017-11-07 16:29:08 +01:00
parent a18fa7b614
commit 80c9d3d446

View file

@ -1428,7 +1428,6 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
Log.i(TAG, "Running tunnel");
jni_run(vpn.getFd(), mapForward.containsKey(53), rcode);
Log.i(TAG, "Tunnel exited");
tunnelThread = null;
}
});
tunnelThread.setPriority(Thread.MAX_PRIORITY);
@ -1442,25 +1441,23 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
private void stopNative(ParcelFileDescriptor vpn, boolean clear) {
Log.i(TAG, "Stop native clear=" + clear);
synchronized (getApplicationContext()) {
if (tunnelThread != null) {
Log.i(TAG, "Stopping tunnel thread");
if (tunnelThread != null) {
Log.i(TAG, "Stopping tunnel thread");
jni_stop();
jni_stop();
while (true)
try {
tunnelThread.join();
break;
} catch (InterruptedException ignored) {
}
tunnelThread = null;
while (true)
try {
tunnelThread.join();
break;
} catch (InterruptedException ignored) {
}
tunnelThread = null;
if (clear)
jni_clear();
if (clear)
jni_clear();
Log.i(TAG, "Stopped tunnel thread");
}
Log.i(TAG, "Stopped tunnel thread");
}
}