FS-3706 see if this helps, otherwise can you test it on other platforms?

This commit is contained in:
Anthony Minessale 2011-11-19 17:10:16 -06:00
parent 475cd91ee8
commit 0ec6b81376
1 changed files with 15 additions and 0 deletions

View File

@ -45,6 +45,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_commands_shutdown);
SWITCH_MODULE_DEFINITION(mod_commands, mod_commands_load, mod_commands_shutdown, NULL);
static switch_mutex_t *reload_mutex = NULL;
struct cb_helper {
uint32_t row_process;
@ -2004,6 +2005,8 @@ SWITCH_STANDARD_API(load_function)
return SWITCH_STATUS_SUCCESS;
}
switch_mutex_lock(reload_mutex);
if (switch_xml_reload(&err) == SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "+OK Reloading XML\n");
}
@ -2014,6 +2017,8 @@ SWITCH_STANDARD_API(load_function)
stream->write_function(stream, "-ERR [%s]\n", err);
}
switch_mutex_unlock(reload_mutex);
return SWITCH_STATUS_SUCCESS;
}
@ -2053,12 +2058,16 @@ SWITCH_STANDARD_API(unload_function)
return SWITCH_STATUS_SUCCESS;
}
switch_mutex_lock(reload_mutex);
if (switch_loadable_module_unload_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) cmd, force, &err) == SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "+OK\n");
} else {
stream->write_function(stream, "-ERR [%s]\n", err);
}
switch_mutex_unlock(reload_mutex);
return SWITCH_STATUS_SUCCESS;
}
@ -2096,6 +2105,8 @@ SWITCH_STANDARD_API(reload_function)
return SWITCH_STATUS_SUCCESS;
}
switch_mutex_lock(reload_mutex);
if (switch_loadable_module_unload_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) cmd, force, &err) == SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "+OK module unloaded\n");
} else {
@ -2112,6 +2123,8 @@ SWITCH_STANDARD_API(reload_function)
stream->write_function(stream, "-ERR loading module [%s]\n", err);
}
switch_mutex_unlock(reload_mutex);
return SWITCH_STATUS_SUCCESS;
}
@ -5238,6 +5251,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
switch_thread_rwlock_create(&bgapi_rwlock, pool);
switch_mutex_init(&reload_mutex, SWITCH_MUTEX_NESTED, pool);
SWITCH_ADD_API(commands_api_interface, "acl", "compare an ip to an acl list", acl_function, "<ip> <list_name>");
SWITCH_ADD_API(commands_api_interface, "alias", "Alias", alias_function, ALIAS_SYNTAX);