mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
turn: use official PJSIP patch to fix TURN
Commit 0bc5829b88
has introduced
a patch recently partialy integrated in PJSIP (see [1]).
But it doesn't take in account TURN error during ALLOCATING state.
This patch replace our patch by the PJSIP one and modify it
to handle the ALLOCATING case.
[1] https://trac.pjsip.org/repos/changeset/5465
Change-Id: Ic45458609e11b55641f13c3e6294eeda599d304e
Reviewed-by: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
This commit is contained in:

committed by
gerrit2

parent
c1f2673ac4
commit
0e90ddb7e9
@ -13,27 +13,41 @@
|
||||
+ continue;
|
||||
+
|
||||
/* Gather remote addresses for this component */
|
||||
@@ -2013,4 +2016,21 @@
|
||||
if (comp->ice_st->state < PJ_ICE_STRANS_STATE_READY) {
|
||||
- sess_fail(comp->ice_st, PJ_ICE_STRANS_OP_INIT,
|
||||
- "TURN allocation failed", info.last_status);
|
||||
+ PJ_LOG(4,(comp->ice_st->obj_name,
|
||||
+ "TURN allocation failed, disable the associated candidate"));
|
||||
+ pj_ice_sess_cand *cand = NULL;
|
||||
+ unsigned i;
|
||||
+ /* Wait until initialization completes */
|
||||
+ pj_grp_lock_acquire(comp->ice_st->grp_lock);
|
||||
+ /* Find relayed candidate in the component */
|
||||
+ for (i=0; i<comp->cand_cnt; ++i) {
|
||||
+ if (comp->cand_list[i].type == PJ_ICE_CAND_TYPE_RELAYED &&
|
||||
+ comp->cand_list[i].transport_id == data->transport_id) {
|
||||
+ cand = &comp->cand_list[i];
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ pj_grp_lock_release(comp->ice_st->grp_lock);
|
||||
+ pj_assert(cand != NULL);
|
||||
+ // Make session init succeed but disable this TURN server to be used
|
||||
+ cand->status = PJNATH_ESTUNTIMEDOUT;
|
||||
+ sess_init_update(comp->ice_st);
|
||||
} else if (comp->turn[tp_idx].err_cnt > 1) {
|
||||
@@ -1995,4 +1998,37 @@
|
||||
sess_init_update(comp->ice_st);
|
||||
|
||||
+ } else if ((old_state == PJ_TURN_STATE_RESOLVING || old_state == PJ_TURN_STATE_ALLOCATING) &&
|
||||
+ new_state >= PJ_TURN_STATE_DEALLOCATING)
|
||||
+ {
|
||||
+ pj_ice_sess_cand *cand = NULL;
|
||||
+ unsigned i;
|
||||
+
|
||||
+ /* DNS resolution has failed! */
|
||||
+ ++comp->turn[tp_idx].err_cnt;
|
||||
+
|
||||
+ /* Unregister ourself from the TURN relay */
|
||||
+ pj_turn_sock_set_user_data(turn_sock, NULL);
|
||||
+ comp->turn[tp_idx].sock = NULL;
|
||||
+
|
||||
+ /* Wait until initialization completes */
|
||||
+ pj_grp_lock_acquire(comp->ice_st->grp_lock);
|
||||
+
|
||||
+ /* Find relayed candidate in the component */
|
||||
+ for (i=0; i<comp->cand_cnt; ++i) {
|
||||
+ if (comp->cand_list[i].type == PJ_ICE_CAND_TYPE_RELAYED &&
|
||||
+ comp->cand_list[i].transport_id == data->transport_id)
|
||||
+ {
|
||||
+ cand = &comp->cand_list[i];
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ pj_assert(cand != NULL);
|
||||
+
|
||||
+ pj_grp_lock_release(comp->ice_st->grp_lock);
|
||||
+
|
||||
+ cand->status = old_state == PJ_TURN_STATE_RESOLVING ? PJ_ERESOLVE : PJ_EINVALIDOP;
|
||||
+
|
||||
+ sess_init_update(comp->ice_st);
|
||||
+
|
||||
} else if (new_state >= PJ_TURN_STATE_DEALLOCATING) {
|
||||
pj_turn_session_info info;
|
||||
|
Reference in New Issue
Block a user