[sr-dev] git:master:0d0c8d57: Merge pull request #469 from smititelu/master

Stefan Mititelu stefan.mititelu at 1and1.ro
Thu Jan 7 10:37:43 CET 2016


Module: kamailio
Branch: master
Commit: 0d0c8d570b58c2a622a615b1c312acca4994d720
URL: https://github.com/kamailio/kamailio/commit/0d0c8d570b58c2a622a615b1c312acca4994d720

Author: Stefan Mititelu <stefan.mititelu at 1and1.ro>
Committer: Stefan Mititelu <stefan.mititelu at 1and1.ro>
Date: 2016-01-07T11:37:37+02:00

Merge pull request #469 from smititelu/master

fix issue #463

---

Modified: modules/debugger/debugger_api.c
Modified: modules/debugger/doc/debugger_admin.xml

---

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

---

diff --git a/modules/debugger/debugger_api.c b/modules/debugger/debugger_api.c
index 566be68..cb57df3 100644
--- a/modules/debugger/debugger_api.c
+++ b/modules/debugger/debugger_api.c
@@ -1344,15 +1344,14 @@ int dbg_set_mod_debug_level(char *mname, int mnlen, int *mlevel)
 		itp = it;
 		it = it->next;
 	}
+	lock_release(&_dbg_mod_table[idx].lock);
 	/* not found - add */
 	if(mlevel==NULL) {
-		lock_release(&_dbg_mod_table[idx].lock);
 		return 0;
 	}
 	itn = (dbg_mod_level_t*)shm_malloc(sizeof(dbg_mod_level_t) + (mnlen+1)*sizeof(char));
 	if(itn==NULL) {
 		LM_ERR("no more shm\n");
-		lock_release(&_dbg_mod_table[idx].lock);
 		return -1;
 	}
 	memset(itn, 0, sizeof(dbg_mod_level_t) + (mnlen+1)*sizeof(char));
@@ -1363,6 +1362,7 @@ int dbg_set_mod_debug_level(char *mname, int mnlen, int *mlevel)
 	strncpy(itn->name.s, mname, mnlen);
 	itn->name.s[itn->name.len] = '\0';
 
+	lock_get(&_dbg_mod_table[idx].lock);
 	if(itp==NULL) {
 		itn->next = _dbg_mod_table[idx].first;
 		_dbg_mod_table[idx].first = itn;
@@ -1420,15 +1420,14 @@ int dbg_set_mod_debug_facility(char *mname, int mnlen, int *mfacility)
 		itp = it;
 		it = it->next;
 	}
+	lock_release(&_dbg_mod_table[idx].lock_ft);
 	/* not found - add */
 	if(mfacility==NULL) {
-		lock_release(&_dbg_mod_table[idx].lock_ft);
 		return 0;
 	}
 	itn = (dbg_mod_facility_t*)shm_malloc(sizeof(dbg_mod_facility_t) + (mnlen+1)*sizeof(char));
 	if(itn==NULL) {
 		LM_ERR("no more shm\n");
-		lock_release(&_dbg_mod_table[idx].lock_ft);
 		return -1;
 	}
 	memset(itn, 0, sizeof(dbg_mod_facility_t) + (mnlen+1)*sizeof(char));
@@ -1439,6 +1438,7 @@ int dbg_set_mod_debug_facility(char *mname, int mnlen, int *mfacility)
 	strncpy(itn->name.s, mname, mnlen);
 	itn->name.s[itn->name.len] = '\0';
 
+	lock_get(&_dbg_mod_table[idx].lock_ft);
 	if(itp==NULL) {
 		itn->next = _dbg_mod_table[idx].first_ft;
 		_dbg_mod_table[idx].first_ft = itn;
diff --git a/modules/debugger/doc/debugger_admin.xml b/modules/debugger/doc/debugger_admin.xml
index 04ba4ee..d0f3511 100644
--- a/modules/debugger/doc/debugger_admin.xml
+++ b/modules/debugger/doc/debugger_admin.xml
@@ -918,7 +918,7 @@ $ &ctltool; fifo get_dbg_mod_facility debugger
 		</title>
 		<para>
 			Get the module log level.
-			If module does not exist in kamailio, the entry in the level hashtable is still added for the bogus module.
+			If mod_name does not exist in the level hashtable, returns the config file value.
 		</para>
 		<para>
 			Name: <emphasis>dbg.get_mod_level</emphasis>
@@ -937,7 +937,7 @@ $ &ctltool; fifo get_dbg_mod_facility debugger
 		</title>
 		<para>
 			Get the module log facility.
-			If module does not exist in kamailio, the entry in the facility hashtable is still added for the bogus module.
+			If mod_name does not exist in the facility hashtable, returns the config file value.
 		</para>
 		<para>
 			Name: <emphasis>dbg.get_mod_facility</emphasis>




More information about the sr-dev mailing list