Skip to content

Commit

Permalink
dialplan: no longer use per MI child init
Browse files Browse the repository at this point in the history
All processes already have the database connection, so there is no need
to re-create it in MI

(cherry picked from commit 7022a48)
  • Loading branch information
razvancrainea committed Sep 13, 2024
1 parent 8cb9a95 commit 9159b27
Showing 1 changed file with 2 additions and 26 deletions.
28 changes: 2 additions & 26 deletions modules/dialplan/dialplan.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@

static int mod_init(void);
static int child_init(int rank);
static int mi_child_init(void);
static void mod_destroy();

static mi_response_t *mi_reload_rules(const mi_params_t *params,
Expand Down Expand Up @@ -107,7 +106,7 @@ static const param_export_t mod_params[]={
};

static const mi_export_t mi_cmds[] = {
{ "dp_reload", 0, 0, mi_child_init, {
{ "dp_reload", 0, 0, NULL, {
{mi_reload_rules, {0}},
{mi_reload_rules_1, {"partition", 0}},
{EMPTY_MI_RECIPE}}
Expand All @@ -117,7 +116,7 @@ static const mi_export_t mi_cmds[] = {
{mi_translate3, {"dpid", "input", "partition", 0}},
{EMPTY_MI_RECIPE}}
},
{ "dp_show_partition", 0, 0, mi_child_init, {
{ "dp_show_partition", 0, 0, NULL, {
{mi_show_partition, {0}},
{mi_show_partition_1, {"partition", 0}},
{EMPTY_MI_RECIPE}}
Expand Down Expand Up @@ -444,29 +443,6 @@ static int child_init(int rank)
}


static int mi_child_init(void)
{
static int mi_child_initialized = 0;
dp_connection_list_p el;

if (mi_child_initialized)
return 0;

/* Connect to DB s */
for(el = dp_conns; el; el = el->next){
if (dp_connect_db(el) != 0) {
/* all el shall be freed in mod destroy */
LM_ERR("Unable to init/connect db connection\n");
return -1;
}
}

mi_child_initialized = 1;
return 0;
}



static void mod_destroy(void)
{
/*destroy shared memory*/
Expand Down

0 comments on commit 9159b27

Please sign in to comment.