|
@@ -58,19 +58,19 @@ static db_func_t mt_dbf;
|
|
#if 0
|
|
#if 0
|
|
INSERT INTO version (table_name, table_version) values ('mtree','1');
|
|
INSERT INTO version (table_name, table_version) values ('mtree','1');
|
|
CREATE TABLE mtree (
|
|
CREATE TABLE mtree (
|
|
- id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
|
|
|
- tprefix VARCHAR(32) NOT NULL,
|
|
|
|
- tvalue VARCHAR(128) DEFAULT '' NOT NULL,
|
|
|
|
- CONSTRAINT tprefix_idx UNIQUE (tprefix)
|
|
|
|
-) ENGINE=MyISAM;
|
|
|
|
|
|
+ id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
|
|
|
+ tprefix VARCHAR(32) NOT NULL,
|
|
|
|
+ tvalue VARCHAR(128) DEFAULT '' NOT NULL,
|
|
|
|
+ CONSTRAINT tprefix_idx UNIQUE (tprefix)
|
|
|
|
+ ) ENGINE=MyISAM;
|
|
INSERT INTO version (table_name, table_version) values ('mtrees','1');
|
|
INSERT INTO version (table_name, table_version) values ('mtrees','1');
|
|
CREATE TABLE mtrees (
|
|
CREATE TABLE mtrees (
|
|
- id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
|
|
|
- tname VARCHAR(128) NOT NULL,
|
|
|
|
- tprefix VARCHAR(32) NOT NULL,
|
|
|
|
- tvalue VARCHAR(128) DEFAULT '' NOT NULL,
|
|
|
|
- CONSTRAINT tname_tprefix_idx UNIQUE (tname, tprefix)
|
|
|
|
-) ENGINE=MyISAM;
|
|
|
|
|
|
+ id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
|
|
|
+ tname VARCHAR(128) NOT NULL,
|
|
|
|
+ tprefix VARCHAR(32) NOT NULL,
|
|
|
|
+ tvalue VARCHAR(128) DEFAULT '' NOT NULL,
|
|
|
|
+ CONSTRAINT tname_tprefix_idx UNIQUE (tname, tprefix)
|
|
|
|
+ ) ENGINE=MyISAM;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
/** parameters */
|
|
/** parameters */
|
|
@@ -187,10 +187,10 @@ static int mod_init(void)
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
if(mtree_init_rpc()!=0)
|
|
if(mtree_init_rpc()!=0)
|
|
- {
|
|
|
|
- LM_ERR("failed to register RPC commands\n");
|
|
|
|
- return -1;
|
|
|
|
- }
|
|
|
|
|
|
+ {
|
|
|
|
+ LM_ERR("failed to register RPC commands\n");
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
|
|
db_url.len = strlen(db_url.s);
|
|
db_url.len = strlen(db_url.s);
|
|
db_table.len = strlen(db_table.s);
|
|
db_table.len = strlen(db_table.s);
|
|
@@ -212,9 +212,9 @@ static int mod_init(void)
|
|
}
|
|
}
|
|
|
|
|
|
if (pv_parse_spec(&values_param, &pv_values) <0
|
|
if (pv_parse_spec(&values_param, &pv_values) <0
|
|
- || pv_values.type != PVT_AVP) {
|
|
|
|
- LM_ERR("cannot parse values avp\n");
|
|
|
|
- return -1;
|
|
|
|
|
|
+ || pv_values.type != PVT_AVP) {
|
|
|
|
+ LM_ERR("cannot parse values avp\n");
|
|
|
|
+ return -1;
|
|
}
|
|
}
|
|
|
|
|
|
if(pv_parse_spec(&dstid_param, &pv_dstid)<0
|
|
if(pv_parse_spec(&dstid_param, &pv_dstid)<0
|
|
@@ -260,7 +260,7 @@ static int mod_init(void)
|
|
if (!DB_CAPABILITY(mt_dbf, DB_CAP_ALL))
|
|
if (!DB_CAPABILITY(mt_dbf, DB_CAP_ALL))
|
|
{
|
|
{
|
|
LM_ERR("database module does not "
|
|
LM_ERR("database module does not "
|
|
- "implement all functions needed by the module\n");
|
|
|
|
|
|
+ "implement all functions needed by the module\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -271,9 +271,9 @@ static int mod_init(void)
|
|
LM_ERR("failed to connect to the database\n");
|
|
LM_ERR("failed to connect to the database\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
LM_DBG("database connection opened successfully\n");
|
|
LM_DBG("database connection opened successfully\n");
|
|
-
|
|
|
|
|
|
+
|
|
if ( (mt_lock=lock_alloc())==0) {
|
|
if ( (mt_lock=lock_alloc())==0) {
|
|
LM_CRIT("failed to alloc lock\n");
|
|
LM_CRIT("failed to alloc lock\n");
|
|
goto error1;
|
|
goto error1;
|
|
@@ -282,7 +282,7 @@ static int mod_init(void)
|
|
LM_CRIT("failed to init lock\n");
|
|
LM_CRIT("failed to init lock\n");
|
|
goto error1;
|
|
goto error1;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if(mt_defined_trees())
|
|
if(mt_defined_trees())
|
|
{
|
|
{
|
|
LM_DBG("static trees defined\n");
|
|
LM_DBG("static trees defined\n");
|
|
@@ -380,7 +380,7 @@ static void mod_destroy(void)
|
|
mt_destroy_trees();
|
|
mt_destroy_trees();
|
|
if (db_con!=NULL && mt_dbf.close!=NULL)
|
|
if (db_con!=NULL && mt_dbf.close!=NULL)
|
|
mt_dbf.close(db_con);
|
|
mt_dbf.close(db_con);
|
|
- /* destroy lock */
|
|
|
|
|
|
+ /* destroy lock */
|
|
if (mt_lock)
|
|
if (mt_lock)
|
|
{
|
|
{
|
|
lock_destroy( mt_lock );
|
|
lock_destroy( mt_lock );
|
|
@@ -392,14 +392,14 @@ static void mod_destroy(void)
|
|
|
|
|
|
static int fixup_mt_match(void** param, int param_no)
|
|
static int fixup_mt_match(void** param, int param_no)
|
|
{
|
|
{
|
|
- if(param_no==1 || param_no==2) {
|
|
|
|
|
|
+ if(param_no==1 || param_no==2) {
|
|
return fixup_spve_null(param, 1);
|
|
return fixup_spve_null(param, 1);
|
|
- }
|
|
|
|
- if (param_no != 3) {
|
|
|
|
|
|
+ }
|
|
|
|
+ if (param_no != 3) {
|
|
LM_ERR("invalid parameter number %d\n", param_no);
|
|
LM_ERR("invalid parameter number %d\n", param_no);
|
|
return E_UNSPEC;
|
|
return E_UNSPEC;
|
|
- }
|
|
|
|
- return fixup_igp_null(param, 1);
|
|
|
|
|
|
+ }
|
|
|
|
+ return fixup_igp_null(param, 1);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -411,7 +411,7 @@ static int mt_match(struct sip_msg *msg, gparam_t *tn, gparam_t *var,
|
|
str tomatch;
|
|
str tomatch;
|
|
int mval;
|
|
int mval;
|
|
m_tree_t *tr = NULL;
|
|
m_tree_t *tr = NULL;
|
|
-
|
|
|
|
|
|
+
|
|
if(msg==NULL)
|
|
if(msg==NULL)
|
|
{
|
|
{
|
|
LM_ERR("received null msg\n");
|
|
LM_ERR("received null msg\n");
|
|
@@ -433,7 +433,7 @@ static int mt_match(struct sip_msg *msg, gparam_t *tn, gparam_t *var,
|
|
LM_ERR("cannot get the mode\n");
|
|
LM_ERR("cannot get the mode\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
again:
|
|
again:
|
|
lock_get( mt_lock );
|
|
lock_get( mt_lock );
|
|
if (mt_reload_flag) {
|
|
if (mt_reload_flag) {
|
|
@@ -458,7 +458,7 @@ again:
|
|
tomatch.len, tomatch.s);
|
|
tomatch.len, tomatch.s);
|
|
goto error;
|
|
goto error;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
lock_get( mt_lock );
|
|
lock_get( mt_lock );
|
|
mt_tree_refcnt--;
|
|
mt_tree_refcnt--;
|
|
lock_release( mt_lock );
|
|
lock_release( mt_lock );
|
|
@@ -540,8 +540,8 @@ static int mt_load_db(str *tname)
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
if((ret=mt_dbf.query(db_con, NULL, NULL, NULL, db_cols,
|
|
if((ret=mt_dbf.query(db_con, NULL, NULL, NULL, db_cols,
|
|
- 0, 2, 0, &db_res))!=0
|
|
|
|
- || RES_ROW_N(db_res)<=0 )
|
|
|
|
|
|
+ 0, 2, 0, &db_res))!=0
|
|
|
|
+ || RES_ROW_N(db_res)<=0 )
|
|
{
|
|
{
|
|
mt_dbf.free_result(db_con, db_res);
|
|
mt_dbf.free_result(db_con, db_res);
|
|
if( ret==0)
|
|
if( ret==0)
|
|
@@ -559,23 +559,23 @@ static int mt_load_db(str *tname)
|
|
/* check for NULL values ?!?! */
|
|
/* check for NULL values ?!?! */
|
|
tprefix.s = (char*)(RES_ROWS(db_res)[i].values[0].val.string_val);
|
|
tprefix.s = (char*)(RES_ROWS(db_res)[i].values[0].val.string_val);
|
|
tprefix.len = strlen(tprefix.s);
|
|
tprefix.len = strlen(tprefix.s);
|
|
-
|
|
|
|
|
|
+
|
|
tvalue.s = (char*)(RES_ROWS(db_res)[i].values[1].val.string_val);
|
|
tvalue.s = (char*)(RES_ROWS(db_res)[i].values[1].val.string_val);
|
|
tvalue.len = strlen(tvalue.s);
|
|
tvalue.len = strlen(tvalue.s);
|
|
|
|
|
|
if(tprefix.s==NULL || tvalue.s==NULL
|
|
if(tprefix.s==NULL || tvalue.s==NULL
|
|
|| tprefix.len<=0 || tvalue.len<=0)
|
|
|| tprefix.len<=0 || tvalue.len<=0)
|
|
{
|
|
{
|
|
- LM_ERR("Error - bad values in db\n");
|
|
|
|
|
|
+ LM_ERR("Error - bad values in db (%p:%p)\n", tprefix.s, tvalue.s);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if(mt_add_to_tree(&new_tree, &tprefix, &tvalue)<0)
|
|
if(mt_add_to_tree(&new_tree, &tprefix, &tvalue)<0)
|
|
{
|
|
{
|
|
LM_ERR("Error adding info to tree\n");
|
|
LM_ERR("Error adding info to tree\n");
|
|
goto error;
|
|
goto error;
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }
|
|
if (DB_CAPABILITY(mt_dbf, DB_CAP_FETCH)) {
|
|
if (DB_CAPABILITY(mt_dbf, DB_CAP_FETCH)) {
|
|
if(mt_dbf.fetch_result(db_con, &db_res, mt_fetch_rows)<0) {
|
|
if(mt_dbf.fetch_result(db_con, &db_res, mt_fetch_rows)<0) {
|
|
LM_ERR("Error while fetching!\n");
|
|
LM_ERR("Error while fetching!\n");
|
|
@@ -663,8 +663,8 @@ static int mt_load_db_trees()
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
if((ret=mt_dbf.query(db_con, NULL, NULL, NULL, db_cols,
|
|
if((ret=mt_dbf.query(db_con, NULL, NULL, NULL, db_cols,
|
|
- 0, 3, &tname_column, &db_res))!=0
|
|
|
|
- || RES_ROW_N(db_res)<=0 )
|
|
|
|
|
|
+ 0, 3, &tname_column, &db_res))!=0
|
|
|
|
+ || RES_ROW_N(db_res)<=0 )
|
|
{
|
|
{
|
|
mt_dbf.free_result(db_con, db_res);
|
|
mt_dbf.free_result(db_con, db_res);
|
|
if( ret==0)
|
|
if( ret==0)
|
|
@@ -690,7 +690,7 @@ static int mt_load_db_trees()
|
|
tvalue.len = strlen(tvalue.s);
|
|
tvalue.len = strlen(tvalue.s);
|
|
|
|
|
|
if(tprefix.s==NULL || tvalue.s==NULL || tname.s==NULL ||
|
|
if(tprefix.s==NULL || tvalue.s==NULL || tname.s==NULL ||
|
|
- tprefix.len<=0 || tvalue.len<=0 || tname.len<=0)
|
|
|
|
|
|
+ tprefix.len<=0 || tvalue.len<=0 || tname.len<=0)
|
|
{
|
|
{
|
|
LM_ERR("Error - bad values in db\n");
|
|
LM_ERR("Error - bad values in db\n");
|
|
continue;
|
|
continue;
|
|
@@ -787,12 +787,12 @@ static struct mi_root* mt_mi_reload(struct mi_root *cmd_tree, void *param)
|
|
}
|
|
}
|
|
|
|
|
|
pt = mt_get_first_tree();
|
|
pt = mt_get_first_tree();
|
|
-
|
|
|
|
|
|
+
|
|
while(pt!=NULL)
|
|
while(pt!=NULL)
|
|
{
|
|
{
|
|
if(tname.s==NULL
|
|
if(tname.s==NULL
|
|
- || (tname.s!=NULL && pt->tname.len>=tname.len
|
|
|
|
- && strncmp(pt->tname.s, tname.s, tname.len)==0))
|
|
|
|
|
|
+ || (tname.s!=NULL && pt->tname.len>=tname.len
|
|
|
|
+ && strncmp(pt->tname.s, tname.s, tname.len)==0))
|
|
{
|
|
{
|
|
/* re-loading table from database */
|
|
/* re-loading table from database */
|
|
if(mt_load_db(&pt->tname)!=0)
|
|
if(mt_load_db(&pt->tname)!=0)
|
|
@@ -804,7 +804,7 @@ static struct mi_root* mt_mi_reload(struct mi_root *cmd_tree, void *param)
|
|
pt = pt->next;
|
|
pt = pt->next;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
return init_mi_tree( 200, MI_OK_S, MI_OK_LEN);
|
|
return init_mi_tree( 200, MI_OK_S, MI_OK_LEN);
|
|
|
|
|
|
error:
|
|
error:
|
|
@@ -823,7 +823,7 @@ int mt_print_mi_node(m_tree_t *tree, mt_node_t *pt, struct mi_node* rpl,
|
|
|
|
|
|
if(pt==NULL || len>=MT_MAX_DEPTH)
|
|
if(pt==NULL || len>=MT_MAX_DEPTH)
|
|
return 0;
|
|
return 0;
|
|
-
|
|
|
|
|
|
+
|
|
for(i=0; i<MT_NODE_SIZE; i++)
|
|
for(i=0; i<MT_NODE_SIZE; i++)
|
|
{
|
|
{
|
|
code[len]=mt_char_list.s[i];
|
|
code[len]=mt_char_list.s[i];
|
|
@@ -838,23 +838,23 @@ int mt_print_mi_node(m_tree_t *tree, mt_node_t *pt, struct mi_node* rpl,
|
|
if(attr == NULL)
|
|
if(attr == NULL)
|
|
goto error;
|
|
goto error;
|
|
attr = add_mi_attr(node, MI_DUP_VALUE, "TPREFIX", 7,
|
|
attr = add_mi_attr(node, MI_DUP_VALUE, "TPREFIX", 7,
|
|
- code, len+1);
|
|
|
|
|
|
+ code, len+1);
|
|
if(attr == NULL)
|
|
if(attr == NULL)
|
|
goto error;
|
|
goto error;
|
|
|
|
|
|
while (tvalues != NULL) {
|
|
while (tvalues != NULL) {
|
|
- if (tree->type == MT_TREE_IVAL) {
|
|
|
|
- val.s = int2str(tvalues->tvalue.n, &val.len);
|
|
|
|
- attr = add_mi_attr(node, MI_DUP_VALUE, "TVALUE", 6,
|
|
|
|
- val.s, val.len);
|
|
|
|
- } else {
|
|
|
|
- attr = add_mi_attr(node, MI_DUP_VALUE, "TVALUE", 6,
|
|
|
|
- tvalues->tvalue.s.s,
|
|
|
|
- tvalues->tvalue.s.len);
|
|
|
|
- }
|
|
|
|
- if(attr == NULL)
|
|
|
|
- goto error;
|
|
|
|
- tvalues = tvalues->next;
|
|
|
|
|
|
+ if (tree->type == MT_TREE_IVAL) {
|
|
|
|
+ val.s = int2str(tvalues->tvalue.n, &val.len);
|
|
|
|
+ attr = add_mi_attr(node, MI_DUP_VALUE, "TVALUE", 6,
|
|
|
|
+ val.s, val.len);
|
|
|
|
+ } else {
|
|
|
|
+ attr = add_mi_attr(node, MI_DUP_VALUE, "TVALUE", 6,
|
|
|
|
+ tvalues->tvalue.s.s,
|
|
|
|
+ tvalues->tvalue.s.len);
|
|
|
|
+ }
|
|
|
|
+ if(attr == NULL)
|
|
|
|
+ goto error;
|
|
|
|
+ tvalues = tvalues->next;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(mt_print_mi_node(tree, pt[i].child, rpl, code, len+1)<0)
|
|
if(mt_print_mi_node(tree, pt[i].child, rpl, code, len+1)<0)
|
|
@@ -909,12 +909,12 @@ struct mi_root* mt_mi_list(struct mi_root* cmd_tree, void* param)
|
|
rpl = &rpl_tree->node;
|
|
rpl = &rpl_tree->node;
|
|
|
|
|
|
pt = mt_get_first_tree();
|
|
pt = mt_get_first_tree();
|
|
-
|
|
|
|
|
|
+
|
|
while(pt!=NULL)
|
|
while(pt!=NULL)
|
|
{
|
|
{
|
|
if(tname.s==NULL ||
|
|
if(tname.s==NULL ||
|
|
- (tname.s!=NULL && pt->tname.len>=tname.len &&
|
|
|
|
- strncmp(pt->tname.s, tname.s, tname.len)==0))
|
|
|
|
|
|
+ (tname.s!=NULL && pt->tname.len>=tname.len &&
|
|
|
|
+ strncmp(pt->tname.s, tname.s, tname.len)==0))
|
|
{
|
|
{
|
|
len = 0;
|
|
len = 0;
|
|
if(mt_print_mi_node(pt, pt->head, rpl, code_buf, len)<0)
|
|
if(mt_print_mi_node(pt, pt->head, rpl, code_buf, len)<0)
|
|
@@ -922,7 +922,7 @@ struct mi_root* mt_mi_list(struct mi_root* cmd_tree, void* param)
|
|
}
|
|
}
|
|
pt = pt->next;
|
|
pt = pt->next;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
return rpl_tree;
|
|
return rpl_tree;
|
|
|
|
|
|
error:
|
|
error:
|
|
@@ -961,7 +961,7 @@ struct mi_root* mt_mi_summary(struct mi_root* cmd_tree, void* param)
|
|
goto error;
|
|
goto error;
|
|
val.s = int2str(pt->type, &val.len);
|
|
val.s = int2str(pt->type, &val.len);
|
|
attr = add_mi_attr(node, MI_DUP_VALUE, "TTYPE", 5,
|
|
attr = add_mi_attr(node, MI_DUP_VALUE, "TTYPE", 5,
|
|
- val.s, val.len);
|
|
|
|
|
|
+ val.s, val.len);
|
|
if(attr == NULL)
|
|
if(attr == NULL)
|
|
goto error;
|
|
goto error;
|
|
val.s = int2str(pt->memsize, &val.len);
|
|
val.s = int2str(pt->memsize, &val.len);
|
|
@@ -998,7 +998,7 @@ void rpc_mtree_summary(rpc_t* rpc, void* c)
|
|
if(!mt_defined_trees())
|
|
if(!mt_defined_trees())
|
|
{
|
|
{
|
|
rpc->fault(c, 500, "Empty tree list.");
|
|
rpc->fault(c, 500, "Empty tree list.");
|
|
- return;
|
|
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
|
|
if (rpc->add(c, "{", &th) < 0)
|
|
if (rpc->add(c, "{", &th) < 0)
|
|
@@ -1011,29 +1011,29 @@ void rpc_mtree_summary(rpc_t* rpc, void* c)
|
|
while(pt!=NULL)
|
|
while(pt!=NULL)
|
|
{
|
|
{
|
|
if(rpc->struct_add(th, "s{",
|
|
if(rpc->struct_add(th, "s{",
|
|
- "table", pt->tname.s,
|
|
|
|
- "item", &ih) < 0)
|
|
|
|
- {
|
|
|
|
- rpc->fault(c, 500, "Internal error creating rpc ih");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ "table", pt->tname.s,
|
|
|
|
+ "item", &ih) < 0)
|
|
|
|
+ {
|
|
|
|
+ rpc->fault(c, 500, "Internal error creating rpc ih");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
if(rpc->struct_add(ih, "d", "ttype", pt->type) < 0 ) {
|
|
if(rpc->struct_add(ih, "d", "ttype", pt->type) < 0 ) {
|
|
- rpc->fault(c, 500, "Internal error adding type");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ rpc->fault(c, 500, "Internal error adding type");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
if(rpc->struct_add(ih, "d", "memsize", pt->memsize) < 0 ) {
|
|
if(rpc->struct_add(ih, "d", "memsize", pt->memsize) < 0 ) {
|
|
- rpc->fault(c, 500, "Internal error adding memsize");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ rpc->fault(c, 500, "Internal error adding memsize");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
if(rpc->struct_add(ih, "d", "nrnodes", pt->nrnodes) < 0 ) {
|
|
if(rpc->struct_add(ih, "d", "nrnodes", pt->nrnodes) < 0 ) {
|
|
- rpc->fault(c, 500, "Internal error adding nodes");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ rpc->fault(c, 500, "Internal error adding nodes");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
if(rpc->struct_add(ih, "d", "nritems", pt->nritems) < 0 ) {
|
|
if(rpc->struct_add(ih, "d", "nritems", pt->nritems) < 0 ) {
|
|
- rpc->fault(c, 500, "Internal error adding items");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ rpc->fault(c, 500, "Internal error adding items");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
pt = pt->next;
|
|
pt = pt->next;
|
|
}
|
|
}
|
|
return;
|
|
return;
|
|
@@ -1066,17 +1066,17 @@ void rpc_mtree_reload(rpc_t* rpc, void* c)
|
|
|
|
|
|
/* read tree name */
|
|
/* read tree name */
|
|
if (rpc->scan(c, "S", &tname) != 1) {
|
|
if (rpc->scan(c, "S", &tname) != 1) {
|
|
- rpc->fault(c, 500, "Failed to get table name parameter");
|
|
|
|
- return;
|
|
|
|
|
|
+ rpc->fault(c, 500, "Failed to get table name parameter");
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
|
|
pt = mt_get_first_tree();
|
|
pt = mt_get_first_tree();
|
|
-
|
|
|
|
|
|
+
|
|
while(pt!=NULL)
|
|
while(pt!=NULL)
|
|
{
|
|
{
|
|
if(tname.s==NULL
|
|
if(tname.s==NULL
|
|
- || (tname.s!=NULL && pt->tname.len>=tname.len
|
|
|
|
- && strncmp(pt->tname.s, tname.s, tname.len)==0))
|
|
|
|
|
|
+ || (tname.s!=NULL && pt->tname.len>=tname.len
|
|
|
|
+ && strncmp(pt->tname.s, tname.s, tname.len)==0))
|
|
{
|
|
{
|
|
/* re-loading table from database */
|
|
/* re-loading table from database */
|
|
if(mt_load_db(&pt->tname)!=0)
|
|
if(mt_load_db(&pt->tname)!=0)
|
|
@@ -1088,7 +1088,7 @@ void rpc_mtree_reload(rpc_t* rpc, void* c)
|
|
pt = pt->next;
|
|
pt = pt->next;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
return;
|
|
return;
|
|
|
|
|
|
error:
|
|
error:
|
|
@@ -1096,8 +1096,8 @@ error:
|
|
}
|
|
}
|
|
|
|
|
|
static const char* rpc_mtree_reload_doc[2] = {
|
|
static const char* rpc_mtree_reload_doc[2] = {
|
|
- "Reload mtrees from database to memory",
|
|
|
|
- 0
|
|
|
|
|
|
+ "Reload mtrees from database to memory",
|
|
|
|
+ 0
|
|
};
|
|
};
|
|
|
|
|
|
rpc_export_t mtree_rpc[] = {
|
|
rpc_export_t mtree_rpc[] = {
|