diff options
author | Benny Prijono <bennylp@teluu.com> | 2010-09-30 23:38:20 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2010-09-30 23:38:20 +0000 |
commit | 2263a30d5a775d8ffd73484f73c6d13e93dab77e (patch) | |
tree | 869445d2f4fcd3aac02020dfb104b35d0588756b | |
parent | d6b77c8c0f20436dcbfc9db85da2e7d7d85fe4ef (diff) |
Closed #1121 (Deadlock in transaction code when hanging up calls): fixed the race condition when setting up transaction timeout
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3328 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjsip/src/pjsip/sip_transaction.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/pjsip/src/pjsip/sip_transaction.c b/pjsip/src/pjsip/sip_transaction.c index dcae9d77..a0fa2291 100644 --- a/pjsip/src/pjsip/sip_transaction.c +++ b/pjsip/src/pjsip/sip_transaction.c @@ -1592,9 +1592,15 @@ PJ_DEF(pj_status_t) pjsip_tsx_set_timeout( pjsip_transaction *tsx, */ lock_timer(tsx); - /* Transaction must not have got final response */ - PJ_ASSERT_ON_FAIL(tsx->status_code < 200, - { unlock_timer(tsx); return PJ_EINVALIDOP; }); + /* Transaction should normally not have final response, but as + * #1121 says there is a (tolerable) window of race condition + * where this might happen. + */ + if (tsx->status_code >= 200 && tsx->timeout_timer.id != 0) { + /* Timeout is already set */ + unlock_timer(tsx); + return PJ_EEXISTS; + } if (tsx->timeout_timer.id != 0) { pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer); |