ICE initialization never completes due to race condition (#2525)

* Fix possible race in ICE in TURN allocation init so TURN candidate status stays PJ_EPENDING.
This commit is contained in:
Nanang Izzuddin 2020-09-29 10:14:07 +07:00 committed by GitHub
parent 0157ddcda3
commit f834154bd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 5 deletions

View File

@ -438,6 +438,14 @@ static pj_status_t add_update_turn(pj_ice_strans *ice_st,
return status;
}
if (new_cand) {
/* Commit the relayed candidate before pj_turn_sock_alloc(), as
* otherwise there can be race condition, please check
* https://github.com/pjsip/pjproject/pull/2525 for more info.
*/
comp->cand_cnt++;
}
/* Add pending job */
///sess_add_ref(ice_st);
@ -450,14 +458,10 @@ static pj_status_t add_update_turn(pj_ice_strans *ice_st,
&turn_cfg->alloc_param);
if (status != PJ_SUCCESS) {
///sess_dec_ref(ice_st);
cand->status = status;
return status;
}
if (new_cand) {
/* Commit the relayed candidate. */
comp->cand_cnt++;
}
PJ_LOG(4,(ice_st->obj_name,
"Comp %d/%d: TURN relay candidate (tpid=%d) "
"waiting for allocation",