Skip to content

Commit

Permalink
Fixed #1756: Race condition in SIP transaction termination (thanks to…
Browse files Browse the repository at this point in the history
… Kevin Harwell for the patch)

git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4807 74dad513-b988-da41-8d7b-12977e46ad98
  • Loading branch information
ming committed Mar 31, 2014
1 parent c191cd5 commit 02ff19d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pjsip/src/pjsip/sip_transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -1610,14 +1610,14 @@ PJ_DEF(pj_status_t) pjsip_tsx_terminate( pjsip_transaction *tsx, int code )

PJ_ASSERT_RETURN(code >= 200, PJ_EINVAL);

if (tsx->state >= PJSIP_TSX_STATE_TERMINATED)
return PJ_SUCCESS;

pj_log_push_indent();

pj_grp_lock_acquire(tsx->grp_lock);
tsx_set_status_code(tsx, code, NULL);
tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, PJSIP_EVENT_USER, NULL);

if (tsx->state < PJSIP_TSX_STATE_TERMINATED) {
tsx_set_status_code(tsx, code, NULL);
tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, PJSIP_EVENT_USER, NULL);
}
pj_grp_lock_release(tsx->grp_lock);

pj_log_pop_indent();
Expand Down

0 comments on commit 02ff19d

Please sign in to comment.