[phodav] spice-webdavd: set quit-service on SIGINT/SIGTERM



commit 8edb8477a5228961a589a831e0ed5ce5f51422ab
Author: Marc-André Lureau <marcandre lureau gmail com>
Date:   Mon Feb 9 14:29:27 2015 +0100

    spice-webdavd: set quit-service on SIGINT/SIGTERM
    
    This is preparation of the service loop in following patch

 spice/spice-webdavd.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c
index 07b9086..571e8b6 100644
--- a/spice/spice-webdavd.c
+++ b/spice/spice-webdavd.c
@@ -206,6 +206,7 @@ typedef struct _Client
   OutputQueue       *queue;
 } Client;
 
+static gboolean quit_service;
 static GMainLoop *loop;
 static GInputStream *mux_istream;
 static GOutputStream *mux_ostream;
@@ -218,6 +219,9 @@ quit (int sig)
 {
   g_debug ("quit %d", sig);
 
+  if (sig == SIGINT || sig == SIGTERM)
+      quit_service = TRUE;
+
   g_main_loop_quit (loop);
 }
 
@@ -382,7 +386,7 @@ mux_data_read_cb (GObject      *source_object,
     {
       g_warning ("error: %s", error->message);
       g_clear_error (&error);
-      quit (1);
+      quit (-1);
       return;
     }
 
@@ -422,7 +426,7 @@ end:
       g_clear_error (&error);
     }
 
-  quit (2);
+  quit (-2);
 }
 
 static void
@@ -450,7 +454,7 @@ end:
       g_clear_error (&error);
     }
 
-  quit (3);
+  quit (-3);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]