From 82096e8f0af7a0bc75fc76749f3a7fdb6e1b028d Mon Sep 17 00:00:00 2001 From: Giacomo Vacca Date: Mon, 17 May 2021 11:56:05 +0200 Subject: [PATCH] tm: t_suspend.c - t_continue_helper() - do not continue processing a reply if it's suspended again (#2721) * tm: t_suspend.c - do not t_continue with reply if suspended * tm: t_suspend.c - unlock t_continue and reset flag if suspended again * tm: t_reply.c - received_reply() done if suspended after route --- src/modules/tm/t_reply.c | 5 +++++ src/modules/tm/t_suspend.c | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/src/modules/tm/t_reply.c b/src/modules/tm/t_reply.c index a46921cbfdd..306ed8f8724 100644 --- a/src/modules/tm/t_reply.c +++ b/src/modules/tm/t_reply.c @@ -2653,6 +2653,11 @@ int reply_received( struct sip_msg *p_msg ) } #endif + if (t->flags & T_ASYNC_SUSPENDED) { + LM_DBG("Reply for suspended transaction, done.\n"); + goto done; + } + if (unlikely(p_msg->msg_flags&FL_RPL_SUSPENDED)) { /* suspended the reply (async) - no error */ goto done; diff --git a/src/modules/tm/t_suspend.c b/src/modules/tm/t_suspend.c index 4c8de42ce6d..04f906f53ca 100644 --- a/src/modules/tm/t_suspend.c +++ b/src/modules/tm/t_suspend.c @@ -404,6 +404,14 @@ int t_continue_helper(unsigned int hash_index, unsigned int label, LM_DBG("restoring previous environment\n"); faked_env( t, 0, 1); + if (t->flags & T_ASYNC_SUSPENDED) { + LM_DBG("The transaction is suspended, so not continuing\n"); + t->flags &= ~T_ASYNC_CONTINUE; + UNLOCK_ASYNC_CONTINUE(t); + set_t(backup_T, backup_T_branch); + return 0; + } + /*lock transaction replies - will be unlocked when reply is relayed*/ LOCK_REPLIES( t ); if ( is_local(t) ) {