Author: anthm Date: Thu Mar 1 12:23:02 2007 New Revision: 4419 Modified: freeswitch/trunk/src/include/switch_core.h freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c freeswitch/trunk/src/switch.c freeswitch/trunk/src/switch_core.c freeswitch/trunk/src/switch_loadable_module.c Log: cleanup Modified: freeswitch/trunk/src/include/switch_core.h ============================================================================== --- freeswitch/trunk/src/include/switch_core.h (original) +++ freeswitch/trunk/src/include/switch_core.h Thu Mar 1 12:23:02 2007 @@ -233,10 +233,9 @@ /*! \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); ///\} Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c Thu Mar 1 12:23:02 2007 @@ -1045,9 +1045,14 @@ 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; Modified: freeswitch/trunk/src/switch.c ============================================================================== --- freeswitch/trunk/src/switch.c (original) +++ freeswitch/trunk/src/switch.c Thu Mar 1 12:23:02 2007 @@ -198,9 +198,6 @@ 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 @@ "\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 @@ nc++; } - if (argv[x] && !strcmp(argv[x], "-vg")) { - vg++; - } if (argv[x] && !strcmp(argv[x], "-conf")) { x++; @@ -389,7 +382,7 @@ switch_core_runtime_loop(nc); - return switch_core_destroy(vg); + return switch_core_destroy(); } /* For Emacs: Modified: freeswitch/trunk/src/switch_core.c ============================================================================== --- freeswitch/trunk/src/switch_core.c (original) +++ freeswitch/trunk/src/switch_core.c Thu Mar 1 12:23:02 2007 @@ -590,13 +590,13 @@ 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 @@ 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 @@ 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 @@ 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_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 @@ if (runtime.memory_pool) { apr_pool_destroy(runtime.memory_pool); - if (!vg) { - apr_terminate(); - } + //apr_terminate(); } return SWITCH_STATUS_SUCCESS; Modified: freeswitch/trunk/src/switch_loadable_module.c ============================================================================== --- freeswitch/trunk/src/switch_loadable_module.c (original) +++ freeswitch/trunk/src/switch_loadable_module.c Thu Mar 1 12:23:02 2007 @@ -75,7 +75,7 @@ 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;