Fix possible race condition in NAT detect between timer and socket. (#3747)

This commit is contained in:
Nanang Izzuddin 2023-10-25 11:00:59 +07:00 committed by GitHub
parent c94b5dd174
commit 5651d24ddb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -414,8 +414,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);
}
@ -934,7 +934,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;
}