Skip to content
Snippets Groups Projects
Commit 682f96cb authored by Richard Mudgett's avatar Richard Mudgett
Browse files

res_statsd.c: Fix returned reload status.

The return status when there was no change in statsd.conf was incorrect.
This resulted in the wrong status message on the CLI when reloading the
module.

* Fixed cleanup on initial load if initializing statsd failed.

Change-Id: Id24fae75f1a7ff584a444a5680e867d989792481
parent f7fb47e5
Branches
Tags
No related merge requests found
...@@ -316,6 +316,14 @@ static void statsd_shutdown(void) ...@@ -316,6 +316,14 @@ static void statsd_shutdown(void)
} }
} }
static int unload_module(void)
{
statsd_shutdown();
aco_info_destroy(&cfg_info);
ao2_global_obj_release(confs);
return 0;
}
static int load_module(void) static int load_module(void)
{ {
if (aco_info_init(&cfg_info)) { if (aco_info_init(&cfg_info)) {
...@@ -364,34 +372,34 @@ static int load_module(void) ...@@ -364,34 +372,34 @@ static int load_module(void)
return AST_MODULE_LOAD_SUCCESS; return AST_MODULE_LOAD_SUCCESS;
} }
if (statsd_init() != 0) { if (statsd_init()) {
aco_info_destroy(&cfg_info); unload_module();
return AST_MODULE_LOAD_DECLINE; return AST_MODULE_LOAD_DECLINE;
} }
return AST_MODULE_LOAD_SUCCESS; return AST_MODULE_LOAD_SUCCESS;
} }
static int unload_module(void)
{
statsd_shutdown();
aco_info_destroy(&cfg_info);
ao2_global_obj_release(confs);
return 0;
}
static int reload_module(void) static int reload_module(void)
{ {
if (aco_process_config(&cfg_info, 1)) { switch (aco_process_config(&cfg_info, 1)) {
case ACO_PROCESS_OK:
break;
case ACO_PROCESS_UNCHANGED:
return AST_MODULE_LOAD_SUCCESS;
case ACO_PROCESS_ERROR:
default:
return AST_MODULE_LOAD_DECLINE; return AST_MODULE_LOAD_DECLINE;
} }
if (is_enabled()) { if (is_enabled()) {
return statsd_init(); if (statsd_init()) {
return AST_MODULE_LOAD_DECLINE;
}
} else { } else {
statsd_shutdown(); statsd_shutdown();
return AST_MODULE_LOAD_SUCCESS;
} }
return AST_MODULE_LOAD_SUCCESS;
} }
/* The priority of this module is set just after realtime, since it loads /* The priority of this module is set just after realtime, since it loads
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment