Skip to content

Commit

Permalink
fix: unlock mutex in hev-jni.c
Browse files Browse the repository at this point in the history
  • Loading branch information
dovecoteescapee authored and heiher committed Aug 18, 2024
1 parent 5bf3fa5 commit 61f3d7a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/hev-jni.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ native_start_service (JNIEnv *env, jobject thiz, jstring config_path, jint fd)
ThreadData *tdata;

pthread_mutex_lock (&mutex);
if (work_thread)
if (work_thread) {
pthread_mutex_unlock (&mutex);
return;
}

tdata = malloc (sizeof (ThreadData));
tdata->fd = fd;
Expand All @@ -122,8 +124,10 @@ static void
native_stop_service (JNIEnv *env, jobject thiz)
{
pthread_mutex_lock (&mutex);
if (!work_thread)
if (!work_thread) {
pthread_mutex_unlock (&mutex);
return;
}

hev_socks5_tunnel_quit ();
pthread_join (work_thread, NULL);
Expand Down

0 comments on commit 61f3d7a

Please sign in to comment.