don't restart runtime functions when shutting down

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16008 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Mathieu Rene 2009-12-21 15:59:18 +00:00
parent 621b76270f
commit 5c86f214b9

View File

@ -53,6 +53,7 @@ struct switch_loadable_module {
switch_memory_pool_t *pool;
switch_status_t status;
switch_thread_t *thread;
switch_bool_t shutting_down;
};
struct switch_loadable_module_container {
@ -90,7 +91,7 @@ static void *SWITCH_THREAD_FUNC switch_loadable_module_exec(switch_thread_t *thr
switch_assert(thread != NULL);
switch_assert(module != NULL);
for (restarts = 0; status != SWITCH_STATUS_TERM; restarts++) {
for (restarts = 0; status != SWITCH_STATUS_TERM && !module->shutting_down; restarts++) {
status = module->switch_module_runtime();
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Thread ended for %s\n", module->module_interface->module_name);
@ -1257,6 +1258,8 @@ static switch_status_t do_shutdown(switch_loadable_module_t *module, switch_bool
return SWITCH_STATUS_FALSE;
}
module->shutting_down = SWITCH_TRUE;
if (shutdown) {
switch_loadable_module_unprocess(module);
if (module->switch_module_shutdown) {