Skip to content

Commit

Permalink
pv_headers: use tm.t_find API
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxmaniac committed Aug 28, 2022
1 parent 46d0356 commit 836d122
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/modules/pv_headers/pv_headers.c
Expand Up @@ -526,6 +526,7 @@ int handle_msg_branch_cb(struct sip_msg *msg, unsigned int flags, void *cb)

int handle_msg_reply_cb(struct sip_msg *msg, unsigned int flags, void *cb)
{
int vref = 0;
tm_cell_t *t = NULL;
sr_xavp_t **backup_xavis = NULL;
sr_xavp_t **list = NULL;
Expand All @@ -534,18 +535,12 @@ int handle_msg_reply_cb(struct sip_msg *msg, unsigned int flags, void *cb)
return 1;
LM_DBG("msg:%p previous branch:%d\n", msg, _branch);

if(tmb.t_check(msg, &_branch) == -1) {
LM_ERR("failed find UAC branch\n");
} else {
t = tmb.t_gett();
if(t == NULL || t == T_UNDEFINED) {
LM_DBG("cannot lookup the transaction\n");
} else {
LM_DBG("T:%p t_check-branch:%d xavi_list:%p branches:%d\n", t,
_branch, &t->xavis_list, t->nr_of_outgoings);
list = &t->xavis_list;
backup_xavis = xavi_set_list(&t->xavis_list);
}
t = tmb.t_find(msg, &_branch, &vref);
if(t != NULL && t != T_UNDEFINED) {
LM_DBG("T:%p t_check-branch:%d xavi_list:%p branches:%d\n", t,
_branch, &t->xavis_list, t->nr_of_outgoings);
list = &t->xavis_list;
backup_xavis = xavi_set_list(&t->xavis_list);
}

pvh_get_branch_index(msg, &_branch);
Expand All @@ -560,7 +555,7 @@ int handle_msg_reply_cb(struct sip_msg *msg, unsigned int flags, void *cb)
xavi_set_list(backup_xavis);
LM_DBG("restored backup_xavis:%p\n", *backup_xavis);
}
if(t) {
if(t && vref) {
tmb.unref_cell(t);
LM_DBG("T:%p unref\n", t);
}
Expand Down

0 comments on commit 836d122

Please sign in to comment.