[Spice-devel] [PATCH spice-server 2/2] Only send device display info to supported agents

Jonathon Jongsma jjongsma at redhat.com
Thu Feb 28 23:09:34 UTC 2019


Only send the graphics device display info to agents that advertise the
VD_AGENT_CAP_GRAPHICS_DEVICE_INFO capability

Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
---
 server/reds-private.h | 1 +
 server/reds.c         | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/server/reds-private.h b/server/reds-private.h
index 9dbc7fa94..b2b99b50e 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -134,6 +134,7 @@ struct RedsState {
     GList *qxl_instances;
     MainDispatcher *main_dispatcher;
     RedRecord *record;
+    gboolean agent_graphics_device_info;
 };
 
 #define FOREACH_QXL_INSTANCE(_reds, _qxl) \
diff --git a/server/reds.c b/server/reds.c
index 63bfadb22..4228ab6ad 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -813,6 +813,10 @@ static void reds_adjust_agent_capabilities(RedsState *reds, VDAgentMessage *mess
     if (!reds->config->agent_file_xfer) {
         VD_AGENT_SET_CAPABILITY(capabilities->caps, VD_AGENT_CAP_FILE_XFER_DISABLED);
     }
+
+    size_t caps_size = VD_AGENT_CAPS_SIZE_FROM_MSG_SIZE(message->size);
+    reds->agent_graphics_device_info = VD_AGENT_HAS_CAPABILITY(capabilities->caps, caps_size,
+                                                               VD_AGENT_CAP_GRAPHICS_DEVICE_INFO);
 }
 
 /* reads from the device till completes reading a message that is addressed to the client,
@@ -965,6 +969,11 @@ void reds_send_device_display_info(RedsState *reds)
     if (!reds->agent_dev->priv->agent_attached) {
         return;
     }
+    if (!reds->agent_graphics_device_info) {
+        g_debug("Not sending device display info to the agent because the agent does not support it");
+        return;
+    }
+
     g_debug("Sending device display info to the agent:");
 
     SpiceMarshaller *m = spice_marshaller_new();
-- 
2.17.2



More information about the Spice-devel mailing list