[Spice-devel] [PATCH] channel: support multiple clients for red_channel_is_waiting_for_migrate_data

Frediano Ziglio fziglio at redhat.com
Thu Dec 10 11:17:38 PST 2015


Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/red-channel.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/server/red-channel.c b/server/red-channel.c
index 7dfb9bf..18f890f 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -963,20 +963,27 @@ int red_channel_client_is_waiting_for_migrate_data(RedChannelClient *rcc)
     return rcc->wait_migrate_data;
 }
 
+/**
+ * Returns TRUE is at least one client is waiting for migration data
+ */
 int red_channel_is_waiting_for_migrate_data(RedChannel *channel)
 {
-    RedChannelClient *rcc;
+    RingItem *link, *next;
 
-    if (!red_channel_is_connected(channel)) {
+    if (!channel) {
         return FALSE;
     }
 
-    if (channel->clients_num > 1) {
-        return FALSE;
+    RING_FOREACH_SAFE(link, next, &channel->clients) {
+        RedChannelClient *rcc;
+
+        rcc = SPICE_CONTAINEROF(link, RedChannelClient, channel_link);
+        if (red_channel_client_is_waiting_for_migrate_data(rcc)) {
+            return TRUE;
+        }
     }
-    spice_assert(channel->clients_num == 1);
-    rcc = SPICE_CONTAINEROF(ring_get_head(&channel->clients), RedChannelClient, channel_link);
-    return red_channel_client_is_waiting_for_migrate_data(rcc);
+
+    return FALSE;
 }
 
 static void red_channel_client_default_connect(RedChannel *channel, RedClient *client,
-- 
2.4.3



More information about the Spice-devel mailing list