]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix enum load unload goodies
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 7 Jul 2008 16:22:55 +0000 (16:22 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 7 Jul 2008 16:22:55 +0000 (16:22 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8904 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_enum/mod_enum.c

index 944c70f8d4988c3bda6ebe04d584f688873d0361..f8c505eb7c4df520000b85dbc0ad461a765c623c 100644 (file)
@@ -73,6 +73,8 @@ typedef struct route enum_route_t;
 
 static enum dns_class qcls = DNS_C_IN;
 
+static switch_event_node_t *NODE = NULL;
+
 static struct {
        char *root;
        char *isn_root;
@@ -80,7 +82,6 @@ static struct {
        switch_memory_pool_t *pool;
        int auto_reload;
        int timeout;
-       switch_event_node_t *node;
 } globals;
 
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_root, globals.root);
@@ -827,19 +828,18 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_enum_load)
 
        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) {
                return SWITCH_STATUS_FALSE;
        }
 
        memset(&globals, 0, sizeof(globals));
        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 */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
        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_event_unbind(&globals.node);
+       switch_event_unbind(&NODE);
 
        if (globals.pool) {
                switch_core_destroy_memory_pool(&globals.pool);
        }
 
-       return SWITCH_STATUS_SUCCESS;
+       return SWITCH_STATUS_UNLOAD;
 }
 
 /* For Emacs: