summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy White <jwhite@codeweavers.com>2012-09-06 16:01:15 -0500
committerJeremy White <jwhite@codeweavers.com>2013-01-11 14:52:52 -0600
commit4908d6c4d13014f38dadfd1020cd680e81f053b7 (patch)
tree82bb04257ab75989e67b15dc3a0dcbafea01f9e4
parent6677781531a8638c3813ee091881271d7d7e23b2 (diff)
Enable the use of SpiceExitOnDisconnect so that Xspice can be configured
to allow exactly one server per client session.
-rw-r--r--examples/spiceqxl.xorg.conf.example2
-rw-r--r--src/qxl.h1
-rw-r--r--src/qxl_driver.c2
-rw-r--r--src/spiceqxl_spice_server.c12
4 files changed, 17 insertions, 0 deletions
diff --git a/examples/spiceqxl.xorg.conf.example b/examples/spiceqxl.xorg.conf.example
index a2f2ad9..6240b14 100644
--- a/examples/spiceqxl.xorg.conf.example
+++ b/examples/spiceqxl.xorg.conf.example
@@ -77,6 +77,8 @@ Section "Device"
# This can dramatically reduce network bandwidth for some use cases.
#Option "SpiceDeferredFPS" "10"
+ # If set, the Spice Server will exit when the first client disconnects
+ #Option "SpiceExitOnDisconnect" "1"
EndSection
Section "InputDevice"
diff --git a/src/qxl.h b/src/qxl.h
index 427bb55..8e2802a 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -128,6 +128,7 @@ enum {
OPTION_SPICE_CACERT_FILE,
OPTION_SPICE_DH_FILE,
OPTION_SPICE_DEFERRED_FPS,
+ OPTION_SPICE_EXIT_ON_DISCONNECT,
#endif
OPTION_COUNT,
};
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 8ba2efa..e2d08c7 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -127,6 +127,8 @@ const OptionInfoRec DefaultOptions[] =
"SpiceDhFile", OPTV_STRING, {0}, FALSE},
{ OPTION_SPICE_DEFERRED_FPS,
"SpiceDeferredFPS", OPTV_INTEGER, {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);