From 5c86f214b9a8b7ab88e2c5bfab0bf6fb065731b6 Mon Sep 17 00:00:00 2001 From: Mathieu Rene Date: Mon, 21 Dec 2009 15:59:18 +0000 Subject: [PATCH] don't restart runtime functions when shutting down git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16008 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_loadable_module.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 268b7ef7d5..0f4570938e 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -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) {