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:
parent
0157ddcda3
commit
f834154bd6
|
@ -438,6 +438,14 @@ static pj_status_t add_update_turn(pj_ice_strans *ice_st,
|
||||||
return status;
|
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 */
|
/* Add pending job */
|
||||||
///sess_add_ref(ice_st);
|
///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);
|
&turn_cfg->alloc_param);
|
||||||
if (status != PJ_SUCCESS) {
|
if (status != PJ_SUCCESS) {
|
||||||
///sess_dec_ref(ice_st);
|
///sess_dec_ref(ice_st);
|
||||||
|
cand->status = status;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_cand) {
|
|
||||||
/* Commit the relayed candidate. */
|
|
||||||
comp->cand_cnt++;
|
|
||||||
}
|
|
||||||
|
|
||||||
PJ_LOG(4,(ice_st->obj_name,
|
PJ_LOG(4,(ice_st->obj_name,
|
||||||
"Comp %d/%d: TURN relay candidate (tpid=%d) "
|
"Comp %d/%d: TURN relay candidate (tpid=%d) "
|
||||||
"waiting for allocation",
|
"waiting for allocation",
|
||||||
|
|
Loading…
Reference in New Issue