[Freeswitch-svn] [commit] r12334 - in freeswitch/trunk/src/mod: event_handlers/mod_event_socket xml_int/mod_xml_rpc

FreeSWITCH SVN mrene at freeswitch.org
Fri Feb 27 12:21:48 PST 2009


Author: mrene
Date: Fri Feb 27 14:21:48 2009
New Revision: 12334

Log:
More initial paradox of doom avoidement

Modified:
   freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
   freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c

Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	Fri Feb 27 14:21:48 2009
@@ -920,6 +920,9 @@
 		if (!strcasecmp(api_command, "unload") && !strcasecmp(api_args, "mod_event_socket")) {
 			api_command = "bgapi";
 			api_args = "unload mod_event_socket";
+		} else if (!strcasecmp(api_command, "reload") && !strcasecmp(api_args, "mod_event_socket")) {
+			api_command = "bgapi";
+			api_args = "reload mod_event_socket";
 		}
 
 		switch_api_execute(api_command, api_args, NULL, stream);
@@ -1351,13 +1354,16 @@
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	char *cmd = switch_event_get_header(*event, "command");
-	char cheat[] = "api bgapi unload mod_event_socket";
+	char unload_cheat[] = "api bgapi unload mod_event_socket";
+	char reload_cheat[] = "api bgapi reload mod_event_socket";
 	
 	*reply = '\0';
 
 	if (switch_stristr("unload", cmd) && switch_stristr("mod_event_socket", cmd)) {
-		cmd = cheat;
-	}
+		cmd = unload_cheat;
+	} else if (switch_stristr("reload", cmd) && switch_stristr("mod_event_socket", cmd)) {
+		cmd = reload_cheat;
+	} 
 
 	if (!strncasecmp(cmd, "exit", 4)) {
 		switch_clear_flag_locked(listener, LFLAG_RUNNING);

Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
==============================================================================
--- freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	(original)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	Fri Feb 27 14:21:48 2009
@@ -685,6 +685,9 @@
 	if (switch_stristr("unload", command) && switch_stristr("mod_xml_rpc", r->requestInfo.query)) {
 		command = "bgapi";
 		api_str = "unload mod_xml_rpc";
+	} else if (switch_stristr("reload", command) && switch_stristr("mod_xml_rpc", r->requestInfo.query)) {
+		command = "bgapi";
+		api_str = "reload mod_xml_rpc";
 	} else {
 		api_str = r->requestInfo.query;
 	}
@@ -719,6 +722,7 @@
 	switch_stream_handle_t stream = { 0 };
 	xmlrpc_value *val = NULL;
 	const char *x_command = "bgapi", x_arg= "unload mod_xml_rpc";
+	switch_bool_t freed = 0;
 
 
 	/* Parse our argument array. */
@@ -731,9 +735,16 @@
 
 	if (switch_stristr("unload", command) && switch_stristr("mod_xml_rpc", arg)) {
 		switch_safe_free(command);
-		command = x_command;
 		switch_safe_free(arg);
-		arg = x_arg;
+		freed = 1;
+		command = "bgapi";
+		arg = "unload mod_xml_rpc";
+	} else 	if (switch_stristr("reload", command) && switch_stristr("mod_xml_rpc", arg)) {
+		switch_safe_free(command);
+		switch_safe_free(arg);
+		freed = 1;
+		command = "bgapi";
+		arg = "reload mod_xml_rpc";
 	}
 
 	SWITCH_STANDARD_STREAM(stream);
@@ -746,11 +757,8 @@
 	}
 
 	/* xmlrpc-c requires us to free memory it malloced from xmlrpc_decompose_value */
-	if (command != x_command) {
+	if (!freed) {
 		switch_safe_free(command);
-	}
-
-	if (arg != x_arg) {
 		switch_safe_free(arg);
 	}
 



More information about the Freeswitch-svn mailing list