]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
don't restart runtime functions when shutting down
authorMathieu Rene <mrene@avgs.ca>
Mon, 21 Dec 2009 15:59:18 +0000 (15:59 +0000)
committerMathieu Rene <mrene@avgs.ca>
Mon, 21 Dec 2009 15:59:18 +0000 (15:59 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16008 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_loadable_module.c

index 268b7ef7d558565bca9262dfad3ad3a63cc158af..0f4570938e3ee496b7237999c95890b6915fb115 100644 (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) {