Skip to content

Commit

Permalink
Do Trasaction post script updates only if method matches
Browse files Browse the repository at this point in the history
A translation of PR #1678 done by @rrb3942
Closes #1678
Closes #1669
  • Loading branch information
bogdan-iancu committed May 16, 2019
1 parent 20be5fe commit 9c960bb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions modules/tm/tm.c
Expand Up @@ -696,7 +696,7 @@ int load_tm( struct tm_binds *tmb)
}


static int do_t_cleanup( struct sip_msg *foo, void *bar)
static int do_t_cleanup( struct sip_msg *req, void *bar)
{
struct cell *t;

Expand All @@ -712,17 +712,18 @@ static int do_t_cleanup( struct sip_msg *foo, void *bar)

reset_e2eack_t();

if ( (t=get_t())!=NULL && t!=T_UNDEFINED && t->uas.request) {
if ( (t=get_t())!=NULL && t!=T_UNDEFINED && /* we have a transaction */
t->uas.request && req->REQ_METHOD==t->uas.request->REQ_METHOD) {
/* check the UAS request not yet updated from script msg */
LOCK_REPLIES(t);
if (t->uas.request->msg_flags & FL_SHM_UPDATED)
LM_DBG("transaction %p already updated! Skipping update!\n", t);
else
update_cloned_msg_from_msg( t->uas.request, foo);
update_cloned_msg_from_msg( t->uas.request, req);
UNLOCK_REPLIES(t);
}

return t_unref(foo) == 0 ? SCB_DROP_MSG : SCB_RUN_ALL;
return t_unref(req) == 0 ? SCB_DROP_MSG : SCB_RUN_ALL;
}


Expand Down

0 comments on commit 9c960bb

Please sign in to comment.