Module: kamailio
Branch: master
Commit: d83a56bcdfeb8ffc75166a62e11ceb4c057c3ce5
URL:
https://github.com/kamailio/kamailio/commit/d83a56bcdfeb8ffc75166a62e11ceb4…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-12-30T00:29:49+01:00
tm: don't free tm cell still linked in wait timer
- wait timer should do the free
- friendlier handling of situation when modules binding to tm do
inconsistent unref operations
---
Modified: modules/tm/h_table.c
Modified: modules/tm/t_funcs.c
Modified: modules/tm/t_funcs.h
---
Diff:
https://github.com/kamailio/kamailio/commit/d83a56bcdfeb8ffc75166a62e11ceb4…
Patch:
https://github.com/kamailio/kamailio/commit/d83a56bcdfeb8ffc75166a62e11ceb4…
---
diff --git a/modules/tm/h_table.c b/modules/tm/h_table.c
index 105230c..ea38de0 100644
--- a/modules/tm/h_table.c
+++ b/modules/tm/h_table.c
@@ -40,6 +40,7 @@
#include "t_reply.h"
#include "t_cancel.h"
#include "t_stats.h"
+#include "t_funcs.h"
#include "h_table.h"
#include "../../fix_lumps.h" /* free_via_clen_lump */
#include "timer.h"
@@ -129,6 +130,11 @@ void free_cell_helper(tm_cell_t* dead_cell, int silent, const char
*fname, unsig
if(likely(silent==0)) {
LM_WARN("removed cell %p is still linked in hash table (%s:%u)\n",
dead_cell, fname, fline);
+ if(t_on_wait(dead_cell)) {
+ LM_WARN("cell %p is still linked in wait timer (%s:%u)"
+ " - skip freeing now\n", dead_cell, fname, fline);
+ return;
+ }
}
unlink_timers(dead_cell);
remove_from_hash_table_unsafe(dead_cell);
diff --git a/modules/tm/t_funcs.c b/modules/tm/t_funcs.c
index cec58e0..e498713 100644
--- a/modules/tm/t_funcs.c
+++ b/modules/tm/t_funcs.c
@@ -150,6 +150,12 @@ void put_on_wait( struct cell *Trans )
}
+int t_on_wait(tm_cell_t *Trans)
+{
+ if(Trans->wait_timer.prev!=NULL || Trans->wait_timer.next!=NULL)
+ return 1;
+ return 0;
+}
/* WARNING: doesn't work from failure route (deadlock, uses t_reply =>
* tries to get the reply lock again) */
diff --git a/modules/tm/t_funcs.h b/modules/tm/t_funcs.h
index 173851b..b7b653e 100644
--- a/modules/tm/t_funcs.h
+++ b/modules/tm/t_funcs.h
@@ -190,6 +190,7 @@ int get_ip_and_port_from_uri( str* uri , unsigned int *param_ip,
void put_on_wait( struct cell *Trans );
+int t_on_wait(tm_cell_t *Trans);
int t_relay_to( struct sip_msg *p_msg ,