Guarantee native stop

This commit is contained in:
M66B 2016-07-03 10:12:31 +02:00
parent bab4790ef7
commit e58d4c3d4b
1 changed files with 7 additions and 1 deletions

View File

@ -1129,7 +1129,13 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
private void stopNative(ParcelFileDescriptor vpn, boolean clear) {
Log.i(TAG, "Stop native clear=" + clear);
jni_stop(vpn.getFd(), clear);
try {
jni_stop(vpn.getFd(), clear);
} catch (Throwable ex) {
// File descriptor might be closed
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
jni_stop(-1, clear);
}
}
private void unprepare() {