[Spice-devel] [PATCH] Enable the use of SpiceExitOnDisconnect so that Xspice can be configured to allow exactly one server per client session.

Jeremy White jwhite at codeweavers.com
Thu Sep 6 14:04:29 PDT 2012


---
 src/qxl.h                   |    1 +
 src/qxl_driver.c            |    2 ++
 src/spiceqxl_spice_server.c |   12 ++++++++++++
 3 files changed, 15 insertions(+)

diff --git a/src/qxl.h b/src/qxl.h
index 8494550..03d08a1 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -125,6 +125,7 @@ enum {
     OPTION_SPICE_TLS_CIPHERS,
     OPTION_SPICE_CACERT_FILE,
     OPTION_SPICE_DH_FILE,
+    OPTION_SPICE_EXIT_ON_DISCONNECT,
 #endif
     OPTION_COUNT,
 };
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index c7b8486..ef099c1 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -123,6 +123,8 @@ const OptionInfoRec DefaultOptions[] =
       "SpiceCacertFile",          OPTV_STRING,    {0}, FALSE},
     { OPTION_SPICE_DH_FILE,
       "SpiceDhFile",              OPTV_STRING,    {0}, FALSE},
+    { OPTION_SPICE_EXIT_ON_DISCONNECT,
+      "SpiceExitOnDisconnect",    OPTV_BOOLEAN,   {0}, FALSE},
 #endif
     
     { -1, NULL, OPTV_NONE, {0}, FALSE }
diff --git a/src/spiceqxl_spice_server.c b/src/spiceqxl_spice_server.c
index 84fad06..0432d21 100644
--- a/src/spiceqxl_spice_server.c
+++ b/src/spiceqxl_spice_server.c
@@ -158,6 +158,9 @@ void xspice_set_spice_server_options(OptionInfoPtr options)
     int disable_copy_paste =
         get_bool_option(options, OPTION_SPICE_DISABLE_COPY_PASTE,
                         "XSPICE_DISABLE_COPY_PASTE");
+    int exit_on_disconnect =
+        get_bool_option(options, OPTION_SPICE_EXIT_ON_DISCONNECT,
+                        "XSPICE_EXIT_ON_DISCONNECT");
     const char *image_compression =
         get_str_option(options, OPTION_SPICE_IMAGE_COMPRESSION,
                        "XSPICE_IMAGE_COMPRESSION");
@@ -263,6 +266,15 @@ void xspice_set_spice_server_options(OptionInfoPtr options)
     }
 #endif
 
+    if (exit_on_disconnect) {
+#if SPICE_SERVER_VERSION >= 0x000b04 /* 0.11.4 */
+        spice_server_set_exit_on_disconnect(spice_server, exit_on_disconnect);
+#else
+        fprintf(stderr, "spice: cannot set exit_on_disconnect (spice >= 0.11.4 required)\n");
+        exit(1);
+#endif
+    }
+
     compression = SPICE_IMAGE_COMPRESS_AUTO_GLZ;
     if (image_compression) {
         compression = parse_compression(image_compression);
-- 
1.7.10.4




More information about the Spice-devel mailing list