[Freeswitch-svn] [commit] r3388 - in freeswitch/trunk/src: . include

Freeswitch SVN anthm at freeswitch.org
Thu Nov 16 14:43:25 EST 2006


Author: anthm
Date: Thu Nov 16 14:43:25 2006
New Revision: 3388

Modified:
   freeswitch/trunk/src/include/switch_core.h
   freeswitch/trunk/src/switch.c
   freeswitch/trunk/src/switch_core.c

Log:
vg mode

Modified: freeswitch/trunk/src/include/switch_core.h
==============================================================================
--- freeswitch/trunk/src/include/switch_core.h	(original)
+++ freeswitch/trunk/src/include/switch_core.h	Thu Nov 16 14:43:25 2006
@@ -219,9 +219,10 @@
 
 /*! 
   \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);
 ///\}
 
 

Modified: freeswitch/trunk/src/switch.c
==============================================================================
--- freeswitch/trunk/src/switch.c	(original)
+++ freeswitch/trunk/src/switch.c	Thu Nov 16 14:43:25 2006
@@ -195,6 +195,7 @@
 	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;						//
@@ -265,6 +266,10 @@
 		if (argv[x] && !strcmp(argv[x], "-nc")) {
 			bg++;
 		}
+
+		if (argv[x] && !strcmp(argv[x], "-vg")) {
+			vg++;
+		}
 	}
 
 	if (die) {
@@ -302,5 +307,5 @@
 
 	switch_core_runtime_loop(bg);
 
-	return switch_core_destroy();
+	return switch_core_destroy(vg);
 }

Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c	(original)
+++ freeswitch/trunk/src/switch_core.c	Thu Nov 16 14:43:25 2006
@@ -4070,7 +4070,7 @@
 	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) {
@@ -4097,7 +4097,9 @@
 	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();
 	
@@ -4108,7 +4110,9 @@
 
 	if (runtime.memory_pool) {
 		apr_pool_destroy(runtime.memory_pool);
-		apr_terminate();
+		if (!vg) {
+			apr_terminate();
+		}
 	}
 
 #ifdef WIN32



More information about the Freeswitch-svn mailing list