]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
vg mode
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 16 Nov 2006 19:43:25 +0000 (19:43 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 16 Nov 2006 19:43:25 +0000 (19:43 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3388 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_core.h
src/switch.c
src/switch_core.c

index 23f11ac765d335c468fdaa56c50a7c3730314f11..8e40776b5153dfdd96b3508632fdc50d17e624d1 100644 (file)
@@ -219,9 +219,10 @@ 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(void);
+SWITCH_DECLARE(switch_status_t) switch_core_destroy(int vg);
 ///\}
 
 
index 601aa85b25b5e60db72292ec653ba3bfe18bb6d5..604add77a9ecc879da588c9de36dc8dab3d849ca 100644 (file)
@@ -195,6 +195,7 @@ int main(int argc, char *argv[])
        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 @@ int main(int argc, char *argv[])
                if (argv[x] && !strcmp(argv[x], "-nc")) {
                        bg++;
                }
+
+               if (argv[x] && !strcmp(argv[x], "-vg")) {
+                       vg++;
+               }
        }
 
        if (die) {
@@ -302,5 +307,5 @@ int main(int argc, char *argv[])
 
        switch_core_runtime_loop(bg);
 
-       return switch_core_destroy();
+       return switch_core_destroy(vg);
 }
index f65377a2dca0d209b871dcdd92de6aa2f7cbf5c8..a06293ce041e38a062610327a424327683fbef5c 100644 (file)
@@ -4070,7 +4070,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(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_DECLARE(switch_status_t) switch_core_destroy(void)
        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 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void)
 
        if (runtime.memory_pool) {
                apr_pool_destroy(runtime.memory_pool);
-               apr_terminate();
+               if (!vg) {
+                       apr_terminate();
+               }
        }
 
 #ifdef WIN32