[Spice-commits] 3 commits - server/cursor-channel.c server/display-channel.c server/red-channel.c

Jonathon Jongsma jjongsma at kemper.freedesktop.org
Thu May 19 19:30:44 UTC 2016


 server/cursor-channel.c  |   14 +-------------
 server/display-channel.c |   11 +----------
 server/red-channel.c     |   34 ++++++++++++++++++++++------------
 3 files changed, 24 insertions(+), 35 deletions(-)

New commits:
commit f7a17f81eac48c88b38420239128b1cbf24e619d
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Wed Feb 25 12:14:36 2015 -0600

    Add red_client_seamless_migration_done_for_channel()
    
    This is a public RedClient API that handles updating itself rather than
    having the RedChannelClient poke around at the internal structure in
    rec_channel_client_seamless_migration_done().

diff --git a/server/red-channel.c b/server/red-channel.c
index 9aef363..43b053a 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -924,23 +924,34 @@ error:
     return NULL;
 }
 
-static void red_channel_client_seamless_migration_done(RedChannelClient *rcc)
+/* returns TRUE If all channels are finished migrating, FALSE otherwise */
+static gboolean red_client_seamless_migration_done_for_channel(RedClient *client)
 {
-    RedsState *reds = red_channel_get_server(rcc->channel);
-    rcc->wait_migrate_data = FALSE;
-
-    pthread_mutex_lock(&rcc->client->lock);
-    rcc->client->num_migrated_channels--;
+    gboolean ret = FALSE;
 
+    pthread_mutex_lock(&client->lock);
+    client->num_migrated_channels--;
     /* we assume we always have at least one channel who has migration data transfer,
      * otherwise, this flag will never be set back to FALSE*/
-    if (!rcc->client->num_migrated_channels) {
-        rcc->client->during_target_migrate = FALSE;
-        rcc->client->seamless_migrate = FALSE;
+    if (!client->num_migrated_channels) {
+        client->during_target_migrate = FALSE;
+        client->seamless_migrate = FALSE;
         /* migration completion might have been triggered from a different thread
          * than the main thread */
-        main_dispatcher_seamless_migrate_dst_complete(reds_get_main_dispatcher(reds),
-                                                      rcc->client);
+        main_dispatcher_seamless_migrate_dst_complete(reds_get_main_dispatcher(client->reds),
+                                                      client);
+        ret = TRUE;
+    }
+    pthread_mutex_unlock(&client->lock);
+
+    return ret;
+}
+
+static void red_channel_client_seamless_migration_done(RedChannelClient *rcc)
+{
+    rcc->wait_migrate_data = FALSE;
+
+    if (red_client_seamless_migration_done_for_channel(rcc->client)) {
         if (rcc->latency_monitor.timer) {
             red_channel_client_start_ping_timer(rcc, PING_TEST_IDLE_NET_TIMEOUT_MS);
         }
@@ -949,7 +960,6 @@ static void red_channel_client_seamless_migration_done(RedChannelClient *rcc)
                                             rcc->connectivity_monitor.timeout);
         }
     }
-    pthread_mutex_unlock(&rcc->client->lock);
 }
 
 int red_channel_client_is_waiting_for_migrate_data(RedChannelClient *rcc)
commit 2e326085ad8bcafa356d5a71ceddbbb5fbd09ce6
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Thu May 19 14:04:57 2016 -0500

    Simplify DisplayChannel hold_item()
    
    Since all pipe items implement refcounting now, just call
    red_pipe_item_ref() and eliminate the switch statement.

diff --git a/server/display-channel.c b/server/display-channel.c
index 1487f10..3f414fd 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1934,16 +1934,7 @@ static void hold_item(RedChannelClient *rcc, RedPipeItem *item)
 {
     spice_return_if_fail(item);
 
-    switch (item->type) {
-    case RED_PIPE_ITEM_TYPE_DRAW:
-    case RED_PIPE_ITEM_TYPE_IMAGE:
-    case RED_PIPE_ITEM_TYPE_STREAM_CLIP:
-    case RED_PIPE_ITEM_TYPE_UPGRADE:
-        red_pipe_item_ref(item);
-        break;
-    default:
-        spice_warn_if_reached();
-    }
+    red_pipe_item_ref(item);
 }
 
 static int handle_migrate_flush_mark(RedChannelClient *rcc)
commit 6b0eabc9036946b99a2303770390602c18d29761
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Thu May 19 13:54:14 2016 -0500

    Remove unnecessary cursor_pipe_item_ref()
    
    Use the base red_pipe_item_ref() instead of adding an additional static
    wrapper function.

diff --git a/server/cursor-channel.c b/server/cursor-channel.c
index c0b2fda..fa462c5 100644
--- a/server/cursor-channel.c
+++ b/server/cursor-channel.c
@@ -340,23 +340,11 @@ static void cursor_channel_send_item(RedChannelClient *rcc, RedPipeItem *pipe_it
     red_channel_client_begin_send_message(rcc);
 }
 
-static RedCursorPipeItem *cursor_pipe_item_ref(RedCursorPipeItem *item)
-{
-    spice_return_val_if_fail(item, NULL);
-
-    red_pipe_item_ref(item);
-    return item;
-}
-
-
 static void cursor_channel_hold_pipe_item(RedChannelClient *rcc, RedPipeItem *item)
 {
-    RedCursorPipeItem *cursor_pipe_item;
-
     spice_return_if_fail(item);
 
-    cursor_pipe_item = SPICE_CONTAINEROF(item, RedCursorPipeItem, base);
-    cursor_pipe_item_ref(cursor_pipe_item);
+    red_pipe_item_ref(item);
 }
 
 CursorChannel* cursor_channel_new(RedWorker *worker)


More information about the Spice-commits mailing list