[Freeswitch-svn] [commit] r12950 - freeswitch/trunk/src/mod/applications/mod_memcache

FreeSWITCH SVN rupa at freeswitch.org
Wed Apr 8 08:54:46 PDT 2009


Author: rupa
Date: Wed Apr  8 10:54:46 2009
New Revision: 12950

Log:
hook reloadxml event


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

Modified: freeswitch/trunk/src/mod/applications/mod_memcache/mod_memcache.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_memcache/mod_memcache.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_memcache/mod_memcache.c	Wed Apr  8 10:54:46 2009
@@ -56,6 +56,8 @@
 	char *memcached_str;
 } globals;
 
+static switch_event_node_t *NODE = NULL;
+
 static switch_status_t config_callback_memcached(switch_xml_config_item_t *data, switch_config_callback_type_t callback_type, switch_bool_t changed) 
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -131,7 +133,7 @@
 {
 	memset(&globals, 0, sizeof(globals));
 	
-	if (switch_xml_config_parse_module_settings("memcache.conf", SWITCH_FALSE, instructions) != SWITCH_STATUS_SUCCESS) {
+	if (switch_xml_config_parse_module_settings("memcache.conf", reload, instructions) != SWITCH_STATUS_SUCCESS) {
 		return SWITCH_STATUS_GENERR;
 	}
 	
@@ -139,6 +141,12 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+static void event_handler(switch_event_t *event)
+{
+	do_config(SWITCH_TRUE);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Memcache Reloaded\n");
+}
+
 SWITCH_STANDARD_API(memcache_function)
 {
 	switch_status_t status;
@@ -338,6 +346,11 @@
 
 	do_config(SWITCH_FALSE);
 	
+	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 event!\n");
+		return SWITCH_STATUS_TERM;
+	}
+	
 	SWITCH_ADD_API(api_interface, "memcache", "Memcache API", memcache_function, "syntax");
 
 	/* indicate that the module should continue to be loaded */



More information about the Freeswitch-svn mailing list