[Spice-devel] [PATCH 6/7] Test client caps separately

Jonathon Jongsma jjongsma at redhat.com
Fri Apr 7 15:24:00 UTC 2017


in main_channel_push_agent_connected(), it used the convenience function
red_channel_test_remote_cap() to determine whether to send the
AGENT_CONNECTED_TOKENS message, or the AGENT_CONNECTED message. However,
this function returns false if *any* one client doesn't support the
capability. We should instead check each individual client separately to
see if they support the capability.
---
 server/main-channel.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/server/main-channel.c b/server/main-channel.c
index be4f758..d018325 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -99,12 +99,16 @@ void main_channel_push_mouse_mode(MainChannel *main_chan, int current_mode,
 
 void main_channel_push_agent_connected(MainChannel *main_chan)
 {
-    if (red_channel_test_remote_cap(RED_CHANNEL(main_chan),
-                                    SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS)) {
-        red_channel_pipes_add_type(RED_CHANNEL(main_chan),
-                                   RED_PIPE_ITEM_TYPE_MAIN_AGENT_CONNECTED_TOKENS);
-    } else {
-        red_channel_pipes_add_empty_msg(RED_CHANNEL(main_chan), SPICE_MSG_MAIN_AGENT_CONNECTED);
+    GListIter iter;
+    RedChannelClient *rcc;
+    FOREACH_CLIENT(RED_CHANNEL(main_chan), iter, rcc) {
+        if (red_channel_client_test_remote_cap(rcc,
+                                               SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS)) {
+            red_channel_client_pipe_add_type(rcc,
+                                             RED_PIPE_ITEM_TYPE_MAIN_AGENT_CONNECTED_TOKENS);
+        } else {
+            red_channel_client_pipe_add_empty_msg(rcc, SPICE_MSG_MAIN_AGENT_CONNECTED);
+        }
     }
 }
 
-- 
2.9.3



More information about the Spice-devel mailing list