Skip to content

Commit

Permalink
Fix possible race condition in NAT detect between timer and socket. (…
Browse files Browse the repository at this point in the history
…#3747)

Change-Id: I8647a23dc2adb6a859c18f1795e7d2b8524ff06b
  • Loading branch information
nanangizz authored and aberaud committed Dec 20, 2023
1 parent a485c68 commit d044ad6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pjnath/src/pjnath/nat_detect.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ static void end_session(nat_detect_session *sess,
delay.sec = 0;
delay.msec = 0;

sess->timer.id = TIMER_DESTROY;
pj_timer_heap_schedule(sess->timer_heap, &sess->timer, &delay);
pj_timer_heap_schedule_w_grp_lock(sess->timer_heap, &sess->timer, &delay,
TIMER_DESTROY, sess->grp_lock);
}


Expand Down Expand Up @@ -933,7 +933,8 @@ static void on_sess_timer(pj_timer_heap_t *th,

if (next_timer) {
pj_time_val delay = {0, TEST_INTERVAL};
pj_timer_heap_schedule(th, te, &delay);
pj_timer_heap_schedule_w_grp_lock(th, te, &delay,
TIMER_TEST, sess->grp_lock);
} else {
te->id = 0;
}
Expand Down

0 comments on commit d044ad6

Please sign in to comment.