[sr-dev] git:4.3:beb0a653: tm: silent mode when freeing transactions at shutdown

Daniel-Constantin Mierla miconda at gmail.com
Tue Jan 19 10:00:49 CET 2016


Module: kamailio
Branch: 4.3
Commit: beb0a65386d0d56e3d5c876b55cd08d3b54985df
URL: https://github.com/kamailio/kamailio/commit/beb0a65386d0d56e3d5c876b55cd08d3b54985df

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-01-19T09:58:31+01:00

tm: silent mode when freeing transactions at shutdown

- they are still linked in tm hash table as it should be, so no warn
  message for that case

(cherry picked from commit 27495c7c34bf963e403c0f711daf9b76076d2ec3)

---

Modified: modules/tm/h_table.c
Modified: modules/tm/h_table.h

---

Diff:  https://github.com/kamailio/kamailio/commit/beb0a65386d0d56e3d5c876b55cd08d3b54985df.diff
Patch: https://github.com/kamailio/kamailio/commit/beb0a65386d0d56e3d5c876b55cd08d3b54985df.patch

---

diff --git a/modules/tm/h_table.c b/modules/tm/h_table.c
index 5aee155..105230c 100644
--- a/modules/tm/h_table.c
+++ b/modules/tm/h_table.c
@@ -115,7 +115,7 @@ unsigned int transaction_count( void )
 
 
 
-void free_cell_helper( struct cell* dead_cell, const char *fname, unsigned int fline )
+void free_cell_helper(tm_cell_t* dead_cell, int silent, const char *fname, unsigned int fline )
 {
 	char *b;
 	int i;
@@ -126,8 +126,10 @@ void free_cell_helper( struct cell* dead_cell, const char *fname, unsigned int f
 	LM_DBG("freeing transaction %p from %s:%u\n", dead_cell, fname, fline);
 
 	if(dead_cell->prev_c!=NULL && dead_cell->next_c!=NULL) {
-		LM_WARN("removed cell %p is still linked in hash table (%s:%u)\n",
+		if(likely(silent==0)) {
+			LM_WARN("removed cell %p is still linked in hash table (%s:%u)\n",
 				dead_cell, fname, fline);
+		}
 		unlink_timers(dead_cell);
 		remove_from_hash_table_unsafe(dead_cell);
 	}
@@ -437,7 +439,7 @@ void free_hash_table(  )
 			/* delete all synonyms at hash-collision-slot i */
 			clist_foreach_safe(&_tm_table->entries[i], p_cell, tmp_cell,
 									next_c){
-				free_cell(p_cell);
+				free_cell_silent(p_cell);
 			}
 		}
 		shm_free(_tm_table);
diff --git a/modules/tm/h_table.h b/modules/tm/h_table.h
index 7cda34e..0cbe24c 100644
--- a/modules/tm/h_table.h
+++ b/modules/tm/h_table.h
@@ -553,8 +553,9 @@ struct s_table* tm_get_table(void);
 struct s_table* init_hash_table(void);
 void   free_hash_table(void);
 
-void   free_cell_helper( struct cell* dead_cell, const char *fname, unsigned int fline);
-#define free_cell(t) free_cell_helper((t), __FILE__, __LINE__)
+void   free_cell_helper(tm_cell_t* dead_cell, int silent, const char *fname, unsigned int fline);
+#define free_cell(t) free_cell_helper((t), 0, __FILE__, __LINE__)
+#define free_cell_silent(t) free_cell_helper((t), 1, __FILE__, __LINE__)
 
 struct cell*  build_cell( struct sip_msg* p_msg );
 




More information about the sr-dev mailing list