Prevent immediate tsx termination upon transport error (#3805)
This commit is contained in:
parent
48f3723d71
commit
ca2e450edf
|
@ -2187,11 +2187,15 @@ static void send_msg_callback( pjsip_send_state *send_state,
|
|||
else
|
||||
sc = PJSIP_SC_TSX_TRANSPORT_ERROR;
|
||||
|
||||
/* Terminate transaction, if it's not already terminated. */
|
||||
tsx_set_status_code(tsx, sc, &err);
|
||||
if (tsx->state != PJSIP_TSX_STATE_TERMINATED &&
|
||||
/* We terminate the transaction for 502 error. For 503,
|
||||
* we will retry it.
|
||||
* See https://github.com/pjsip/pjproject/pull/3805
|
||||
*/
|
||||
if (sc == PJSIP_SC_BAD_GATEWAY &&
|
||||
tsx->state != PJSIP_TSX_STATE_TERMINATED &&
|
||||
tsx->state != PJSIP_TSX_STATE_DESTROYED)
|
||||
{
|
||||
tsx_set_status_code(tsx, sc, &err);
|
||||
/* Set tsx state to TERMINATED, but release the lock
|
||||
* when invoking the callback, to avoid deadlock.
|
||||
*/
|
||||
|
@ -2204,6 +2208,7 @@ static void send_msg_callback( pjsip_send_state *send_state,
|
|||
*/
|
||||
else if (tsx->transport_flag & TSX_HAS_PENDING_DESTROY)
|
||||
{
|
||||
tsx_set_status_code(tsx, sc, &err);
|
||||
tsx_set_state( tsx, PJSIP_TSX_STATE_DESTROYED,
|
||||
PJSIP_EVENT_TRANSPORT_ERROR,
|
||||
send_state->tdata, 0);
|
||||
|
|
Loading…
Reference in New Issue