Skip to content

Commit b6c64d3

Browse files
romanmichalvasko
authored andcommitted
session server BUGFIX access tid correctly
1 parent 2c10534 commit b6c64d3

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/session_server.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3848,18 +3848,22 @@ API void
38483848
nc_server_notif_cert_expiration_thread_stop(int wait)
38493849
{
38503850
int r;
3851+
pthread_t tid;
38513852

38523853
/* LOCK */
38533854
pthread_mutex_lock(&server_opts.cert_exp_notif.lock);
3855+
tid = server_opts.cert_exp_notif.tid;
3856+
38543857
if (server_opts.cert_exp_notif.thread_running) {
3855-
/* set the running flag to 0, signal the thread and unlock its mutex */
3858+
/* set the tid and running flag to 0, signal the thread and unlock its mutex */
38563859
server_opts.cert_exp_notif.thread_running = 0;
3860+
server_opts.cert_exp_notif.tid = 0;
38573861
pthread_cond_signal(&server_opts.cert_exp_notif.cond);
38583862

38593863
/* UNLOCK */
38603864
pthread_mutex_unlock(&server_opts.cert_exp_notif.lock);
38613865
if (wait) {
3862-
r = pthread_join(server_opts.cert_exp_notif.tid, NULL);
3866+
r = pthread_join(tid, NULL);
38633867
if (r) {
38643868
ERR(NULL, "Joining the certificate expiration notification thread failed (%s).", strerror(r));
38653869
}

0 commit comments

Comments
 (0)