mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-26 12:37:26 +00:00
fix enum load unload goodies
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8904 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
ac467b5d09
commit
3d494aed64
@ -73,6 +73,8 @@ typedef struct route enum_route_t;
|
|||||||
|
|
||||||
static enum dns_class qcls = DNS_C_IN;
|
static enum dns_class qcls = DNS_C_IN;
|
||||||
|
|
||||||
|
static switch_event_node_t *NODE = NULL;
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
char *root;
|
char *root;
|
||||||
char *isn_root;
|
char *isn_root;
|
||||||
@ -80,7 +82,6 @@ static struct {
|
|||||||
switch_memory_pool_t *pool;
|
switch_memory_pool_t *pool;
|
||||||
int auto_reload;
|
int auto_reload;
|
||||||
int timeout;
|
int timeout;
|
||||||
switch_event_node_t *node;
|
|
||||||
} globals;
|
} globals;
|
||||||
|
|
||||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_root, globals.root);
|
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_root, globals.root);
|
||||||
@ -827,6 +828,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_enum_load)
|
|||||||
|
|
||||||
switch_mutex_init(&MUTEX, SWITCH_MUTEX_NESTED, pool);
|
switch_mutex_init(&MUTEX, SWITCH_MUTEX_NESTED, pool);
|
||||||
|
|
||||||
|
if ((switch_event_bind_removable(modname, SWITCH_EVENT_RELOADXML, NULL, event_handler, NULL, &NODE) != SWITCH_STATUS_SUCCESS)) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
|
||||||
|
return SWITCH_STATUS_TERM;
|
||||||
|
}
|
||||||
|
|
||||||
if (dns_init(0) < 0) {
|
if (dns_init(0) < 0) {
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
@ -834,12 +840,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_enum_load)
|
|||||||
memset(&globals, 0, sizeof(globals));
|
memset(&globals, 0, sizeof(globals));
|
||||||
do_load();
|
do_load();
|
||||||
|
|
||||||
|
|
||||||
if (switch_event_bind_removable(modname, SWITCH_EVENT_RELOADXML, NULL, event_handler, NULL, &globals.node) != SWITCH_STATUS_SUCCESS) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
|
|
||||||
return SWITCH_STATUS_TERM;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* connect my internal structure to the blank pointer passed to me */
|
/* connect my internal structure to the blank pointer passed to me */
|
||||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||||
SWITCH_ADD_API(api_interface, "enum", "ENUM", enum_function, "");
|
SWITCH_ADD_API(api_interface, "enum", "ENUM", enum_function, "");
|
||||||
@ -856,13 +856,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_enum_load)
|
|||||||
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_enum_shutdown)
|
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_enum_shutdown)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch_event_unbind(&globals.node);
|
switch_event_unbind(&NODE);
|
||||||
|
|
||||||
if (globals.pool) {
|
if (globals.pool) {
|
||||||
switch_core_destroy_memory_pool(&globals.pool);
|
switch_core_destroy_memory_pool(&globals.pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_UNLOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For Emacs:
|
/* For Emacs:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user