Revision
16008
Author
mrene
Date
2009-12-21 09:59:18 -0600 (Mon, 21 Dec 2009)

Log Message

don't restart runtime functions when shutting down

Modified Paths

Diff

Modified: freeswitch/trunk/src/switch_loadable_module.c (16007 => 16008)


--- freeswitch/trunk/src/switch_loadable_module.c	2009-12-21 04:37:50 UTC (rev 16007)
+++ freeswitch/trunk/src/switch_loadable_module.c	2009-12-21 15:59:18 UTC (rev 16008)
@@ -53,6 +53,7 @@
 	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 @@
 	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 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
+	module->shutting_down = SWITCH_TRUE;
+
 	if (shutdown) {
 		switch_loadable_module_unprocess(module);
 		if (module->switch_module_shutdown) {