Commit 6f43e85b authored by Mygod's avatar Mygod

Fix #2030

parent 88bff42c
......@@ -261,11 +261,11 @@ class VpnService : BaseVpnService(), LocalDnsService.Interface {
var tries = 0
val path = File(Core.deviceStorage.noBackupFilesDir, "sock_path").absolutePath
while (true) try {
Thread.sleep(30L shl tries)
Thread.sleep(50L shl tries)
JniHelper.sendFd(fd, path)
return
} catch (e: ErrnoException) {
if (tries >= 10) throw e
if (tries > 5) throw e
tries += 1
}
}
......
......@@ -24,7 +24,8 @@ static void throwException(JNIEnv* env, jclass exceptionClass, jmethodID ctor2,
static void throwErrnoException(JNIEnv* env, const char* functionName) {
int error = errno;
static jclass ErrnoException = env->FindClass("android/system/ErrnoException");
static jclass ErrnoException = static_cast<jclass>(env->NewGlobalRef(
env->FindClass("android/system/ErrnoException")));
static jmethodID ctor2 = env->GetMethodID(ErrnoException, "<init>", "(Ljava/lang/String;I)V");
throwException(env, ErrnoException, ctor2, functionName, error);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment