[dvblast-devel] [PATCH 07/20] When CMD_SHUTDOWN is received set b_exit_now flag to exit cleanly.

Georgi Chorbadzhiyski gf at unixsol.org
Mon Sep 5 09:52:42 CEST 2011


---
 comm.c    |    8 ++++----
 dvblast.h |    1 +
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/comm.c b/comm.c
index a59fe3f..ec2ab0f 100644
--- a/comm.c
+++ b/comm.c
@@ -148,10 +148,10 @@ void comm_Read( void )
         break;
 
     case CMD_SHUTDOWN:
-        msg_Err( NULL, "shutdown via comm" );
-        exit(EXIT_SUCCESS);
-        /* this is a bit violent, but hey, closing everything cleanly
-         * would do approximately the same */
+        b_exit_now = 1;
+        i_answer = RET_OK;
+        i_answer_size = 0;
+        break;
 
     default:
         msg_Err( NULL, "wrong command %u", i_command );
diff --git a/dvblast.h b/dvblast.h
index b294f84..2b67cdc 100644
--- a/dvblast.h
+++ b/dvblast.h
@@ -166,6 +166,7 @@ extern uint8_t *p_network_name;
 extern size_t i_network_name_size;
 extern mtime_t i_wallclock;
 extern volatile int b_hup_received;
+extern volatile int b_exit_now;
 extern int i_comm_fd;
 extern char *psz_udp_src;
 extern int i_asi_adapter;
-- 
1.7.5.1



More information about the dvblast-devel mailing list