Skip to content

Commit

Permalink
[tm] fix t_wait_no_more_branches() behaviour
Browse files Browse the repository at this point in the history
Fixes #2891
Alternative to  #2898
Credits for the fix go to @man1207

(cherry picked from commit 14d900f)
  • Loading branch information
bogdan-iancu committed Oct 25, 2022
1 parent 1682d4e commit 60476c9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions modules/tm/t_fwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1018,18 +1018,18 @@ static int dst_to_msg(struct sip_msg *s_msg, struct sip_msg *d_msg)
}


int t_wait_no_more_branches( struct cell *t)
int t_wait_no_more_branches( struct cell *t, int extra)
{
int b;

/* look back (in the set of active branches for a PHONY branch
* that might contoll the EBR waiting. If found, update it
* (the br_flags field), so that this is the lasr allowed injected
* that might control the EBR waiting. If found, update it
* (the br_flags field), so that this is the last allowed injected
* branch (the max number of allowed branches is set to the current
* number of branches) */
for ( b=t->nr_of_outgoings-1; b>=t->first_branch ; b-- ) {
if (t->uac[b].flags & T_UAC_IS_PHONY) {
t->uac[b].br_flags=t->nr_of_outgoings+1;
t->uac[b].br_flags=t->nr_of_outgoings+extra;
return 0;
}
}
Expand Down Expand Up @@ -1092,7 +1092,7 @@ int t_inject_branch( struct cell *t, struct sip_msg *msg, int flags)
}

if (flags&TM_INJECT_FLAG_LAST)
t_wait_no_more_branches(t);
t_wait_no_more_branches(t, 1/*the branch we will create*/);

/* generated the new branches, without branch counter reset */
rc = t_forward_nonack( t, &faked_req , NULL, 0, 1/*locked*/ );
Expand Down
2 changes: 1 addition & 1 deletion modules/tm/t_fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int t_inject_ul_event_branch(void);

int t_inject_branch( struct cell *t, struct sip_msg *msg, int flags);

int t_wait_no_more_branches( struct cell *t);
int t_wait_no_more_branches( struct cell *t, int extra);

void get_cancel_reason(struct sip_msg *msg, int flags, str *reason);

Expand Down
2 changes: 1 addition & 1 deletion modules/tm/tm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1590,7 +1590,7 @@ static int w_t_wait_no_more_branches(struct sip_msg* msg)
return -1;
}

if (t_wait_no_more_branches(t)<0)
if (t_wait_no_more_branches(t, 0)<0)
return -1;

return 1;
Expand Down

0 comments on commit 60476c9

Please sign in to comment.