Module: kamailio Branch: master Commit: 5fe2a1a1c67b550431dcae3c98701073f7edd953 URL: https://github.com/kamailio/kamailio/commit/5fe2a1a1c67b550431dcae3c98701073f7edd953
Author: Daniel-Constantin Mierla <mico...@gmail.com> Committer: Daniel-Constantin Mierla <mico...@gmail.com> Date: 2018-06-11T12:39:53+02:00 tm: backup and restore T and T_branch in t_continue() - it may be required to cleanup old T states after t_continue() is finished --- Modified: src/modules/tm/t_suspend.c --- Diff: https://github.com/kamailio/kamailio/commit/5fe2a1a1c67b550431dcae3c98701073f7edd953.diff Patch: https://github.com/kamailio/kamailio/commit/5fe2a1a1c67b550431dcae3c98701073f7edd953.patch --- diff --git a/src/modules/tm/t_suspend.c b/src/modules/tm/t_suspend.c index a150829699..205c945d4c 100644 --- a/src/modules/tm/t_suspend.c +++ b/src/modules/tm/t_suspend.c @@ -166,7 +166,9 @@ int t_suspend(struct sip_msg *msg, int t_continue_helper(unsigned int hash_index, unsigned int label, struct action *rtact, str *cbname, str *cbparam) { - struct cell *t; + tm_cell_t *t; + tm_cell_t *backup_T = T_UNDEFINED; + int backup_T_branch = T_BR_UNDEFINED; sip_msg_t *faked_req; sip_msg_t *brpl; void *erpl; @@ -187,13 +189,18 @@ int t_continue_helper(unsigned int hash_index, unsigned int label, cfg_update(); + backup_T = get_t(); + backup_T_branch = get_t_branch(); + if (t_lookup_ident(&t, hash_index, label) < 0) { + set_t(backup_T, backup_T_branch); LM_ERR("transaction not found\n"); return -1; } if (!(t->flags & T_ASYNC_SUSPENDED)) { LM_WARN("transaction is not suspended [%u:%u]\n", hash_index, label); + set_t(backup_T, backup_T_branch); return -2; } @@ -203,7 +210,7 @@ int t_continue_helper(unsigned int hash_index, unsigned int label, * needless to continue */ UNREF(t); /* t_unref would kill the transaction */ /* reset T as we have no working T anymore */ - set_t(T_UNDEFINED, T_BR_UNDEFINED); + set_t(backup_T, backup_T_branch); return 1; } @@ -248,6 +255,7 @@ int t_continue_helper(unsigned int hash_index, unsigned int label, t->flags &= ~T_ASYNC_CONTINUE; UNLOCK_ASYNC_CONTINUE(t); UNREF(t); /* t_unref would kill the transaction */ + set_t(backup_T, backup_T_branch); return 1; } @@ -387,7 +395,6 @@ int t_continue_helper(unsigned int hash_index, unsigned int label, if(keng->froute(t->uac[branch].reply, TM_ONREPLY_ROUTE, cbname, &evname)<0) { LM_ERR("error running event route kemi callback\n"); - return -1; } } else { LM_DBG("event callback (%.*s) set, but no cfg engine\n", @@ -539,7 +546,7 @@ int t_continue_helper(unsigned int hash_index, unsigned int label, sip_msg_free(brpl); } - + set_t(backup_T, backup_T_branch); return 0; kill_trans: @@ -566,6 +573,7 @@ int t_continue_helper(unsigned int hash_index, unsigned int label, /* response handling */ t_unref(t->uac[branch].reply); } + set_t(backup_T, backup_T_branch); return ret; } _______________________________________________ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev