[Freeswitch-svn] [commit] r8904 - freeswitch/trunk/src/mod/applications/mod_enum

Freeswitch SVN anthm at freeswitch.org
Mon Jul 7 12:22:55 EDT 2008


Author: anthm
Date: Mon Jul  7 12:22:55 2008
New Revision: 8904

Modified:
   freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c

Log:
fix enum load unload goodies

Modified: freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c	Mon Jul  7 12:22:55 2008
@@ -73,6 +73,8 @@
 
 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 @@
 	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_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_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:



More information about the Freeswitch-svn mailing list