Skip to content

Commit

Permalink
move db data initialization from mi_child_init to child init
Browse files Browse the repository at this point in the history
(cherry picked from commit fa14431)
  • Loading branch information
ionutrazvanionita authored and bogdan-iancu committed May 25, 2015
1 parent 9cd6e6f commit 52554da
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions modules/dialplan/dialplan.c
Expand Up @@ -61,7 +61,6 @@
static int mod_init(void);
static int child_init(int rank);
static void mod_destroy();
static int mi_child_init();

static struct mi_root * mi_reload_rules(struct mi_root *cmd_tree,void *param);
static struct mi_root * mi_translate(struct mi_root *cmd_tree, void *param);
Expand Down Expand Up @@ -94,7 +93,7 @@ static param_export_t mod_params[]={
};

static mi_export_t mi_cmds[] = {
{ "dp_reload", 0, mi_reload_rules, 0, 0, mi_child_init},
{ "dp_reload", 0, mi_reload_rules, 0, 0, 0},
{ "dp_translate", 0, mi_translate, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0}
};
Expand Down Expand Up @@ -519,6 +518,22 @@ static int mod_init(void)

static int child_init(int rank)
{
dp_connection_list_p el;

/* only process with rank 0 loads data */
if (rank != 1)
return 0;

/*Connect to DB s and get rules*/
for(el = dp_conns; el; el = el->next){
if (init_db_data(el) != 0) {
LM_ERR("Unable to init db data\n");
shm_free(el);
return -1;
}
}


return 0;
}

Expand All @@ -545,24 +560,6 @@ static void mod_destroy(void)
}


static int mi_child_init(void)
{

dp_connection_list_p el;

/*Connect to DB s and get rules*/
for(el = dp_conns; el; el = el->next){
if (init_db_data(el) != 0) {
LM_ERR("Unable to init db data\n");
shm_free(el);
return -1;
}
}

return 0;
}


static int dp_get_ivalue(struct sip_msg* msg, dp_param_p dp, int *val)
{
pv_value_t value;
Expand Down

0 comments on commit 52554da

Please sign in to comment.