/*!
\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(void);
+SWITCH_DECLARE(switch_status_t) switch_core_destroy(int vg);
///\}
char pid_path[256] = ""; // full path to the pid file
const char *err = NULL; // error value for return from freeswitch initialization
int bg = 0; // TRUE if we are running in background mode
+ int vg = 0; // TRUE if we are running in vg mode
FILE *f; // file handle to the pid file
pid_t pid = 0; //
int x; //
if (argv[x] && !strcmp(argv[x], "-nc")) {
bg++;
}
+
+ if (argv[x] && !strcmp(argv[x], "-vg")) {
+ vg++;
+ }
}
if (die) {
switch_core_runtime_loop(bg);
- return switch_core_destroy();
+ return switch_core_destroy(vg);
}
return 0;
}
-SWITCH_DECLARE(switch_status_t) switch_core_destroy(void)
+SWITCH_DECLARE(switch_status_t) switch_core_destroy(int vg)
{
switch_event_t *event;
if (switch_event_create(&event, SWITCH_EVENT_SHUTDOWN) == SWITCH_STATUS_SUCCESS) {
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();
if (runtime.memory_pool) {
apr_pool_destroy(runtime.memory_pool);
- apr_terminate();
+ if (!vg) {
+ apr_terminate();
+ }
}
#ifdef WIN32