[Spice-devel] [PATCH] Delay the exit call for the exit on disconnect function.

Jeremy White jwhite at codeweavers.com
Wed Nov 2 15:42:11 UTC 2016


This will allow client cleanup to happen.

Signed-off-by: Jeremy White <jwhite at codeweavers.com>
---
 server/reds.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/server/reds.c b/server/reds.c
index c235421..e380dd1 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -559,12 +559,6 @@ void reds_client_disconnect(RedsState *reds, RedClient *client)
 {
     RedsMigTargetClient *mig_client;
 
-    if (reds->config->exit_on_disconnect)
-    {
-        spice_info("Exiting server because of client disconnect.\n");
-        exit(0);
-    }
-
     if (!client || client->disconnecting) {
         spice_debug("client %p already during disconnection", client);
         return;
@@ -599,6 +593,12 @@ void reds_client_disconnect(RedsState *reds, RedClient *client)
     reds->num_clients--;
     red_client_destroy(client);
 
+    if (reds->config->exit_on_disconnect)
+    {
+        spice_info("Exiting server because of client disconnect.\n");
+        exit(0);
+    }
+
    // TODO: we need to handle agent properly for all clients!!!! (e.g., cut and paste, how? Maybe throw away messages
    // if we are in the middle of one from another client)
     if (reds->num_clients == 0) {
-- 
2.1.4



More information about the Spice-devel mailing list