diff options
author | Benny Prijono <bennylp@teluu.com> | 2012-03-30 07:10:13 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2012-03-30 07:10:13 +0000 |
commit | 6b4964727bffb379aca9601e1cf69051ccbf600c (patch) | |
tree | 1d9739ea8b3b5e0421f1d99b39e798b1514fb644 /pjnath | |
parent | 85ac546acb235df62169c4ad317da74a62e56a88 (diff) |
Re #1474: Merged all changes from 1.12 - HEAD (from the 1.x branch)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3999 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjnath')
-rw-r--r-- | pjnath/src/pjnath/ice_session.c | 15 | ||||
-rw-r--r-- | pjnath/src/pjnath/ice_strans.c | 10 | ||||
-rw-r--r-- | pjnath/src/pjnath/stun_sock.c | 2 |
3 files changed, 22 insertions, 5 deletions
diff --git a/pjnath/src/pjnath/ice_session.c b/pjnath/src/pjnath/ice_session.c index c77f7928..bf94e545 100644 --- a/pjnath/src/pjnath/ice_session.c +++ b/pjnath/src/pjnath/ice_session.c @@ -2854,6 +2854,8 @@ PJ_DEF(pj_status_t) pj_ice_sess_send_data(pj_ice_sess *ice, pj_status_t status = PJ_SUCCESS; pj_ice_sess_comp *comp; pj_ice_sess_cand *cand; + pj_uint8_t transport_id; + pj_sockaddr addr; PJ_ASSERT_RETURN(ice && comp_id, PJ_EINVAL); @@ -2869,22 +2871,29 @@ PJ_DEF(pj_status_t) pj_ice_sess_send_data(pj_ice_sess *ice, comp = find_comp(ice, comp_id); if (comp == NULL) { status = PJNATH_EICEINCOMPID; + pj_mutex_unlock(ice->mutex); goto on_return; } if (comp->valid_check == NULL) { status = PJNATH_EICEINPROGRESS; + pj_mutex_unlock(ice->mutex); goto on_return; } cand = comp->valid_check->lcand; - status = (*ice->cb.on_tx_pkt)(ice, comp_id, cand->transport_id, + transport_id = cand->transport_id; + pj_sockaddr_cp(&addr, &comp->valid_check->rcand->addr); + + /* Release the mutex now to avoid deadlock (see ticket #1451). */ + pj_mutex_unlock(ice->mutex); + + status = (*ice->cb.on_tx_pkt)(ice, comp_id, transport_id, data, data_len, - &comp->valid_check->rcand->addr, + &addr, sizeof(pj_sockaddr_in)); on_return: - pj_mutex_unlock(ice->mutex); return status; } diff --git a/pjnath/src/pjnath/ice_strans.c b/pjnath/src/pjnath/ice_strans.c index 129f399b..f9db39dd 100644 --- a/pjnath/src/pjnath/ice_strans.c +++ b/pjnath/src/pjnath/ice_strans.c @@ -1180,8 +1180,11 @@ PJ_DEF(pj_status_t) pj_ice_strans_sendto( pj_ice_strans *ice_st, /* If ICE is available, send data with ICE, otherwise send with the * default candidate selected during initialization. + * + * https://trac.pjsip.org/repos/ticket/1416: + * Once ICE has failed, also send data with the default candidate. */ - if (ice_st->ice) { + if (ice_st->ice && ice_st->state < PJ_ICE_STRANS_STATE_FAILED) { if (comp->turn_sock) { pj_turn_sock_lock(comp->turn_sock); } @@ -1406,6 +1409,11 @@ static pj_bool_t stun_on_rx_data(pj_stun_sock *stun_sock, pj_status_t status; comp = (pj_ice_strans_comp*) pj_stun_sock_get_user_data(stun_sock); + if (comp == NULL) { + /* We have disassociated ourselves from the STUN socket */ + return PJ_FALSE; + } + ice_st = comp->ice_st; sess_add_ref(ice_st); diff --git a/pjnath/src/pjnath/stun_sock.c b/pjnath/src/pjnath/stun_sock.c index 99704fb7..75cf5822 100644 --- a/pjnath/src/pjnath/stun_sock.c +++ b/pjnath/src/pjnath/stun_sock.c @@ -504,7 +504,7 @@ static pj_status_t get_mapped_addr(pj_stun_sock *stun_sock) PJ_FALSE, PJ_TRUE, &stun_sock->srv_addr, pj_sockaddr_get_len(&stun_sock->srv_addr), tdata); - if (status != PJ_SUCCESS) + if (status != PJ_SUCCESS && status != PJ_EPENDING) goto on_error; return PJ_SUCCESS; |