Skip to content

Commit

Permalink
HevJNI: Fix missing mutex unlock.
Browse files Browse the repository at this point in the history
  • Loading branch information
heiher committed Aug 18, 2024
1 parent 5b349ff commit f3a37fa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/hev-jni.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ native_start_service (JNIEnv *env, jobject thiz, jstring config_path)

pthread_mutex_lock (&mutex);
if (work_thread)
return;
goto exit;

tdata = malloc (sizeof (ThreadData));

Expand All @@ -111,6 +111,7 @@ native_start_service (JNIEnv *env, jobject thiz, jstring config_path)
(*env)->ReleaseStringUTFChars (env, config_path, (const char *)bytes);

pthread_create (&work_thread, NULL, thread_handler, tdata);
exit:
pthread_mutex_unlock (&mutex);
}

Expand All @@ -119,11 +120,12 @@ native_stop_service (JNIEnv *env, jobject thiz)
{
pthread_mutex_lock (&mutex);
if (!work_thread)
return;
goto exit;

hev_socks5_server_quit ();
pthread_join (work_thread, NULL);
work_thread = 0;
exit:
pthread_mutex_unlock (&mutex);
}

Expand Down

0 comments on commit f3a37fa

Please sign in to comment.