[sr-dev] git:master:c216abc5: mtree: rpc reload without table name reloads all tables

Daniel-Constantin Mierla miconda at gmail.com
Tue Aug 21 08:31:12 CEST 2018


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-08-21T08:30:00+02:00

mtree: rpc reload without table name reloads all tables

- lost feature in rpc which was available in mi command

---

Modified: src/modules/mtree/mtree_mod.c

---

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

---

diff --git a/src/modules/mtree/mtree_mod.c b/src/modules/mtree/mtree_mod.c
index 4ce2786afb..0710186869 100644
--- a/src/modules/mtree/mtree_mod.c
+++ b/src/modules/mtree/mtree_mod.c
@@ -930,7 +930,8 @@ static const char* rpc_mtree_summary_doc[2] = {
 void rpc_mtree_reload(rpc_t* rpc, void* c)
 {
 	str tname = {0, 0};
-	m_tree_t *pt;
+	m_tree_t *pt = NULL;
+	int treloaded = 0;
 
 	if(db_table.len>0)
 	{
@@ -949,8 +950,13 @@ void rpc_mtree_reload(rpc_t* rpc, void* c)
 
 		/* read tree name */
 		if (rpc->scan(c, "S", &tname) != 1) {
-			rpc->fault(c, 500, "Failed to get table name parameter");
-			return;
+			tname.s = 0;
+			tname.len = 0;
+		} else {
+			if(*tname.s=='.') {
+				tname.s = 0;
+				tname.len = 0;
+			}
 		}
 
 		pt = mt_get_first_tree();
@@ -967,9 +973,13 @@ void rpc_mtree_reload(rpc_t* rpc, void* c)
 					LM_ERR("cannot re-load mtree from database\n");
 					goto error;
 				}
+				treloaded = 1;
 			}
 			pt = pt->next;
 		}
+		if(treloaded == 0) {
+			rpc->fault(c, 500, "No Mtree Name Matching");
+		}
 	}
 
 	return;




More information about the sr-dev mailing list