diff --git a/src/include/switch_core.h b/src/include/switch_core.h index c78c89f780..1266aed580 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -233,10 +233,9 @@ SWITCH_DECLARE(uint32_t) switch_core_session_limit(uint32_t new_limit); /*! \brief Destroy the core - \param vg nonzero to skip core uninitilize for memory debugging \note to be called at application shutdown */ -SWITCH_DECLARE(switch_status_t) switch_core_destroy(int vg); +SWITCH_DECLARE(switch_status_t) switch_core_destroy(void); ///\} diff --git a/src/mod/endpoints/mod_portaudio/mod_portaudio.c b/src/mod/endpoints/mod_portaudio/mod_portaudio.c index 1b65b111fb..d006ac5cbf 100644 --- a/src/mod/endpoints/mod_portaudio/mod_portaudio.c +++ b/src/mod/endpoints/mod_portaudio/mod_portaudio.c @@ -1045,9 +1045,14 @@ static switch_status_t load_config(void) SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void) { - switch_core_codec_destroy(&globals.read_codec); - switch_core_codec_destroy(&globals.write_codec); - + if (globals.read_codec.implementation) { + switch_core_codec_destroy(&globals.read_codec); + } + + if (globals.write_codec.implementation) { + switch_core_codec_destroy(&globals.write_codec); + } + Pa_Terminate(); return SWITCH_STATUS_SUCCESS; diff --git a/src/switch.c b/src/switch.c index 2a61daa5bb..2201812f7d 100644 --- a/src/switch.c +++ b/src/switch.c @@ -198,9 +198,6 @@ int main(int argc, char *argv[]) const char *err = NULL; // error value for return from freeswitch initialization #ifndef WIN32 int nf = 0; // TRUE if we are running in nofork mode - int vg = 0; // Allways TRUE on windows to not do apr_terminate -#else - int vg = 1; // TRUE if we are running in vg mode #endif int nc = 0; // TRUE if we are running in noconsole mode FILE *f; // file handle to the pid file @@ -233,7 +230,6 @@ int main(int argc, char *argv[]) "\t-hp -- enable high priority settings\n" "\t-stop -- stop freeswitch\n" "\t-nc -- do not output to a console and background\n" - "\t-vg -- enable valgrind mode\n" "\t-conf [confdir] -- specify an alternate config dir\n" "\t-log [logdir] -- specify an alternate log dir\n" "\t-db [dbdir] -- specify an alternate db dir\n"; @@ -307,9 +303,6 @@ int main(int argc, char *argv[]) nc++; } - if (argv[x] && !strcmp(argv[x], "-vg")) { - vg++; - } if (argv[x] && !strcmp(argv[x], "-conf")) { x++; @@ -389,7 +382,7 @@ int main(int argc, char *argv[]) switch_core_runtime_loop(nc); - return switch_core_destroy(vg); + return switch_core_destroy(); } /* For Emacs: diff --git a/src/switch_core.c b/src/switch_core.c index 19ebcf6475..a7cdd75905 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -590,13 +590,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_lock(switch_core_sessio if (switch_test_flag(session, SSF_DESTROYED)) { status = SWITCH_STATUS_FALSE; #ifdef SWITCH_DEBUG_RWLOCKS - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_DEBUG, "%s Read lock FAIL\n", + switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "%s Read lock FAIL\n", switch_channel_get_name(session->channel)); #endif } else { status = (switch_status_t) switch_thread_rwlock_tryrdlock(session->rwlock); #ifdef SWITCH_DEBUG_RWLOCKS - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_DEBUG, "%s Read lock AQUIRED\n", + switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "%s Read lock AQUIRED\n", switch_channel_get_name(session->channel)); #endif } @@ -612,7 +612,7 @@ SWITCH_DECLARE(void) switch_core_session_perform_write_lock(switch_core_session_ int line) { - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_DEBUG, "%s Write lock AQUIRED\n", + switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "%s Write lock AQUIRED\n", switch_channel_get_name(session->channel)); #else SWITCH_DECLARE(void) switch_core_session_write_lock(switch_core_session_t *session) @@ -627,7 +627,7 @@ SWITCH_DECLARE(void) switch_core_session_perform_rwunlock(switch_core_session_t const char *func, int line) { - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_DEBUG, "%s Read/Write lock CLEARED\n", + switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "%s Read/Write lock CLEARED\n", switch_channel_get_name(session->channel)); #else SWITCH_DECLARE(void) switch_core_session_rwunlock(switch_core_session_t *session) @@ -4563,7 +4563,7 @@ SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, uint32 return 0; } -SWITCH_DECLARE(switch_status_t) switch_core_destroy(int vg) +SWITCH_DECLARE(switch_status_t) switch_core_destroy(void) { switch_event_t *event; if (switch_event_create(&event, SWITCH_EVENT_SHUTDOWN) == SWITCH_STATUS_SUCCESS) { @@ -4590,9 +4590,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(int vg) switch_core_db_close(runtime.db); switch_core_db_close(runtime.event_db); switch_xml_destroy(); - if (vg) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Full destruction of the core disabled for memory debugging purposes.\n"); - } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Finalizing Shutdown.\n"); switch_log_shutdown(); @@ -4617,9 +4614,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(int vg) if (runtime.memory_pool) { apr_pool_destroy(runtime.memory_pool); - if (!vg) { - apr_terminate(); - } + //apr_terminate(); } return SWITCH_STATUS_SUCCESS; diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 58a2b032eb..aab8342c0b 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -75,7 +75,7 @@ static void *switch_loadable_module_exec(switch_thread_t *thread, void *obj) for (restarts = 0; status != SWITCH_STATUS_TERM; restarts++) { status = module->switch_module_runtime(); } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Thread ended for %s\n", module->module_interface->module_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Thread ended for %s\n", module->module_interface->module_name); if (ts->pool) { switch_memory_pool_t *pool = ts->pool;