diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2016-10-21 06:38:16 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2016-10-21 06:38:16 +0000 |
commit | 65dcb4b3f16706c10ecaffe9af27e50898375a6a (patch) | |
tree | a37ced0b0a94a686a029e26c713c66092d96e0d6 | |
parent | 238f846625a0837f27cf3b4f4815409c6df3d02e (diff) |
Fix #1972: Update ICE candidate status to non-PJ_EPENDING after TURN server name resolution fails.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5465 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjnath/src/pjnath/ice_strans.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/pjnath/src/pjnath/ice_strans.c b/pjnath/src/pjnath/ice_strans.c index 44dbe2c1..7ef22a99 100644 --- a/pjnath/src/pjnath/ice_strans.c +++ b/pjnath/src/pjnath/ice_strans.c @@ -1989,6 +1989,39 @@ static void turn_on_state(pj_turn_sock *turn_sock, pj_turn_state_t old_state, sess_init_update(comp->ice_st); + } else if (old_state == PJ_TURN_STATE_RESOLVING && + new_state == PJ_TURN_STATE_DESTROYING) + { + 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 = PJ_ERESOLVE; + + sess_init_update(comp->ice_st); + } else if (new_state >= PJ_TURN_STATE_DEALLOCATING) { pj_turn_session_info info; |