[Spice-devel] [RFCv5 29/47] server/reds: add RedsState.allow_multiple_clients

Alon Levy alevy at redhat.com
Sun May 8 06:11:25 PDT 2011


Currently set by environment variable SPICE_DEBUG_ALLOW_MC (any value means
to allow multiple connections). Later will be set by spice api from qemu.
---
 server/reds.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/server/reds.c b/server/reds.c
index 083ac19..321f333 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -74,6 +74,10 @@
 SpiceCoreInterface *core = NULL;
 static SpiceCharDeviceInstance *vdagent = NULL;
 
+/* Debugging only variable: allow multiple client connections to the spice
+ * server */
+#define SPICE_DEBUG_ALLOW_MC_ENV "SPICE_DEBUG_ALLOW_MC"
+
 #define MIGRATION_NOTIFY_SPICE_KEY "spice_mig_ext"
 
 #define REDS_MIG_VERSION 3
@@ -229,6 +233,7 @@ typedef struct RedsState {
     RedsStatValue roundtrip_stat;
 #endif
     int peer_minor_version;
+    int allow_multiple_clients;
 } RedsState;
 
 static RedsState *reds = NULL;
@@ -1521,7 +1526,9 @@ static void reds_handle_main_link(RedLinkInfo *link)
 
     red_printf("");
     link_mess = link->link_mess;
-    reds_disconnect();
+    if (!reds->allow_multiple_clients) {
+        reds_disconnect();
+    }
 
     if (link_mess->connection_id == 0) {
         reds_send_link_result(link, SPICE_LINK_ERR_OK);
@@ -3542,6 +3549,10 @@ static int do_spice_init(SpiceCoreInterface *core_interface)
 #endif
 
     reds->mouse_mode = SPICE_MOUSE_MODE_SERVER;
+    reds->allow_multiple_clients = getenv(SPICE_DEBUG_ALLOW_MC_ENV) != NULL;
+    if (reds->allow_multiple_clients) {
+        red_printf("spice: allowing multiple client connections");
+    }
     atexit(reds_exit);
     return 0;
 
-- 
1.7.5.1



More information about the Spice-devel mailing list