diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2016-07-13 09:57:26 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2016-07-13 09:57:26 +0000 |
commit | 5fb0f734da0840c49bc2ec2e11b2d2b3b6e096b4 (patch) | |
tree | 3c91b2b8ee6e71878cdfc9240e9f9a6e69311758 /pjnath | |
parent | b81a9275705ad5c3d3ab202061039d6f42ad2ffa (diff) |
Re #1942:
- Reverted back r5375, otherwise retrying next server will not work as it is using the ALLOCATING -> RESOLVED.
- Don't set state to RESOLVED when pj_stun_session_send_msg() fails to avoid infinite loop, simply return the error code and let application destroy the TURN client session (which is already done by TURN socket).
- Handle allocation error when delayed allocation fails (otherwise TURN client session may never get destroyed?).
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5380 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjnath')
-rw-r--r-- | pjnath/src/pjnath/turn_session.c | 8 | ||||
-rw-r--r-- | pjnath/src/pjnath/turn_sock.c | 10 |
2 files changed, 6 insertions, 12 deletions
diff --git a/pjnath/src/pjnath/turn_session.c b/pjnath/src/pjnath/turn_session.c index 6e933d42..8a530021 100644 --- a/pjnath/src/pjnath/turn_session.c +++ b/pjnath/src/pjnath/turn_session.c @@ -784,7 +784,8 @@ PJ_DEF(pj_status_t) pj_turn_session_alloc(pj_turn_session *sess, /* Set state back to RESOLVED. We don't want to destroy session now, * let the application do it if it wants to. */ - set_state(sess, PJ_TURN_STATE_RESOLVED); + /* Set state back to RESOLVED may cause infinite loop (see #1942). */ + //set_state(sess, PJ_TURN_STATE_RESOLVED); } pj_grp_lock_release(sess->grp_lock); @@ -1749,7 +1750,10 @@ static void dns_srv_resolver_cb(void *user_data, /* Run pending allocation */ if (sess->pending_alloc) { - pj_turn_session_alloc(sess, NULL); + pj_status_t status; + status = pj_turn_session_alloc(sess, NULL); + if (status != PJ_SUCCESS) + on_session_fail(sess, PJ_STUN_ALLOCATE_METHOD, status, NULL); } } diff --git a/pjnath/src/pjnath/turn_sock.c b/pjnath/src/pjnath/turn_sock.c index 20ddb0a7..541175c6 100644 --- a/pjnath/src/pjnath/turn_sock.c +++ b/pjnath/src/pjnath/turn_sock.c @@ -737,16 +737,6 @@ static void turn_on_state(pj_turn_session *sess, return; } - if (old_state == PJ_TURN_STATE_ALLOCATING && - new_state == PJ_TURN_STATE_RESOLVED) - { - /* TURN session won't destroy itself upon allocation failure, it will - * just revert back TURN state to PJ_TURN_STATE_RESOLVED. So, let's - * avoid infinite loop here (see ticket #1942). - */ - return; - } - /* Notify app first */ if (turn_sock->cb.on_state) { (*turn_sock->cb.on_state)(turn_sock, old_state, new_state); |