diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-06-05 11:48:15 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-06-05 11:48:15 +0000 |
commit | 82e58e2e16de31af902bd138182fcd78facd8c1e (patch) | |
tree | 3c9b51f1c21e1ec2fec22d396c23eacafe96b9ed /pjnath | |
parent | 9d75f83c5d80be09012f51c2155fc4245d07b7dc (diff) |
Fixed assertion error in ice_strans.c, when response is received before get_stun_mapped_addr() returns
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1338 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjnath')
-rw-r--r-- | pjnath/src/pjnath/ice_strans.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/pjnath/src/pjnath/ice_strans.c b/pjnath/src/pjnath/ice_strans.c index 5e3a71b0..c789d28f 100644 --- a/pjnath/src/pjnath/ice_strans.c +++ b/pjnath/src/pjnath/ice_strans.c @@ -675,13 +675,10 @@ static pj_status_t get_stun_mapped_addr(pj_ice_strans *ice_st, cand = &comp->cand_list[comp->cand_cnt]; tdata->user_data = (void*)cand; - /* Send STUN binding request */ - status = pj_stun_session_send_msg(comp->stun_sess, PJ_FALSE, - &ice_st->stun_srv, - sizeof(pj_sockaddr_in), tdata); - if (status != PJ_SUCCESS) - return status; - + /* Add pending count first, since stun_on_request_complete() + * may be called before this function completes + */ + comp->pending_cnt++; /* Add new alias to this component */ cand->type = PJ_ICE_CAND_TYPE_SRFLX; @@ -693,8 +690,15 @@ static pj_status_t get_stun_mapped_addr(pj_ice_strans *ice_st, ++comp->cand_cnt; - /* Add pending count for this component */ - comp->pending_cnt++; + /* Send STUN binding request */ + status = pj_stun_session_send_msg(comp->stun_sess, PJ_FALSE, + &ice_st->stun_srv, + sizeof(pj_sockaddr_in), tdata); + if (status != PJ_SUCCESS) { + --comp->pending_cnt; + --comp->cand_cnt; + return status; + } return PJ_SUCCESS; } |