More initial paradox of doom avoidement
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12334 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
284fbf3349
commit
dab63328cd
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue