]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
More initial paradox of doom avoidement
authorMathieu Rene <mrene@avgs.ca>
Fri, 27 Feb 2009 20:21:48 +0000 (20:21 +0000)
committerMathieu Rene <mrene@avgs.ca>
Fri, 27 Feb 2009 20:21:48 +0000 (20:21 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12334 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/event_handlers/mod_event_socket/mod_event_socket.c
src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c

index 73f8b4e4e5b84c66e20bb610a228de2939df66dd..bf1c31e2350a5476f068325e66ff08820382d4a6 100644 (file)
@@ -920,6 +920,9 @@ SWITCH_STANDARD_API(event_sink_function)
                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 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
 {
        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);
index 166d9fd672233fe43286c4931d5c64637dbf31aa..5aff2d013b8045a4e56c8c23d20c9c9388ff8f71 100644 (file)
@@ -685,6 +685,9 @@ abyss_bool handler_hook(TSession * r)
        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 @@ static xmlrpc_value *freeswitch_api(xmlrpc_env * const envP, xmlrpc_value * cons
        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 @@ static xmlrpc_value *freeswitch_api(xmlrpc_env * const envP, xmlrpc_value * cons
 
        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 @@ static xmlrpc_value *freeswitch_api(xmlrpc_env * const envP, xmlrpc_value * cons
        }
 
        /* 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);
        }