From 5117efcff7b61cd9ac9db88ab36a325b26f773ec Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Sun, 24 Apr 2011 10:31:41 +0300 Subject: server/reds: add RedsState.allow_multiple_clients 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 file changed, 12 insertions(+), 1 deletion(-) (limited to 'server/reds.c') diff --git a/server/reds.c b/server/reds.c index e078594f..b8b4d26f 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 @@ -228,6 +232,7 @@ typedef struct RedsState { RedsStatValue roundtrip_stat; #endif int peer_minor_version; + int allow_multiple_clients; } RedsState; static RedsState *reds = NULL; @@ -1502,7 +1507,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); @@ -3533,6 +3540,10 @@ static int do_spice_init(SpiceCoreInterface *core_interface) inputs_init(); 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; -- cgit