[Spice-commits] 2 commits - server/red_channel.c

Yonit Halperin yhalperi at kemper.freedesktop.org
Thu May 2 06:32:20 PDT 2013


 server/red_channel.c |   21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

New commits:
commit b71ccec83e97d3add619390623db6b0dfd35fdcd
Author: Yonit Halperin <yhalperi at redhat.com>
Date:   Wed May 1 13:04:15 2013 -0400

    red_channel: on migration target, start sending ping messages only after the client's migration has completed
    
    The connection to the target server is established before migration
    starts. However, the client reads and replies to messages from the server only after
    migration completes. Thus, we better not send ping msgs from the target
    before migration completes (because the observed roundtrip duration will
    be bigger than the real one).

diff --git a/server/red_channel.c b/server/red_channel.c
index 4e03d64..9d71543 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -805,7 +805,9 @@ RedChannelClient *red_channel_client_create(int size, RedChannel *channel, RedCl
     if (monitor_latency) {
         rcc->latency_monitor.timer = channel->core->timer_add(
             red_channel_client_ping_timer, rcc);
-        red_channel_client_start_ping_timer(rcc, PING_TEST_IDLE_NET_TIMEOUT_MS);
+        if (!client->during_target_migrate) {
+            red_channel_client_start_ping_timer(rcc, PING_TEST_IDLE_NET_TIMEOUT_MS);
+        }
         rcc->latency_monitor.roundtrip = -1;
     }
 
@@ -832,6 +834,9 @@ static void red_channel_client_seamless_migration_done(RedChannelClient *rcc)
         /* migration completion might have been triggered from a different thread
          * than the main thread */
         main_dispatcher_seamless_migrate_dst_complete(rcc->client);
+        if (rcc->latency_monitor.timer) {
+            red_channel_client_start_ping_timer(rcc, PING_TEST_IDLE_NET_TIMEOUT_MS);
+        }
     }
     pthread_mutex_unlock(&rcc->client->lock);
 }
@@ -2004,6 +2009,8 @@ void red_client_set_main(RedClient *client, MainChannelClient *mcc) {
 
 void red_client_semi_seamless_migrate_complete(RedClient *client)
 {
+    RingItem *link;
+
     pthread_mutex_lock(&client->lock);
     if (!client->during_target_migrate || client->seamless_migrate) {
         spice_error("unexpected");
@@ -2011,6 +2018,13 @@ void red_client_semi_seamless_migrate_complete(RedClient *client)
         return;
     }
     client->during_target_migrate = FALSE;
+    RING_FOREACH(link, &client->channels) {
+        RedChannelClient *rcc = SPICE_CONTAINEROF(link, RedChannelClient, client_link);
+
+        if (rcc->latency_monitor.timer) {
+            red_channel_client_start_ping_timer(rcc, PING_TEST_IDLE_NET_TIMEOUT_MS);
+        }
+    }
     pthread_mutex_unlock(&client->lock);
     reds_on_client_semi_seamless_migrate_complete(client);
 }
commit df2603655202e5f9a7a6b45a2b2b8609128fdf16
Author: Yonit Halperin <yhalperi at redhat.com>
Date:   Wed May 1 13:01:43 2013 -0400

    red_channel: stop sending ping messages after migration has completed
    
    We mustn't send any msg to the client, besides MSG_MIGRATE_DATA, after
    we send MSG_MIGRATE.

diff --git a/server/red_channel.c b/server/red_channel.c
index 9047762..4e03d64 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -873,6 +873,11 @@ static void red_channel_client_default_disconnect(RedChannelClient *base)
 
 void red_channel_client_default_migrate(RedChannelClient *rcc)
 {
+    if (rcc->latency_monitor.timer) {
+        red_channel_client_cancel_ping_timer(rcc);
+        rcc->channel->core->timer_remove(rcc->latency_monitor.timer);
+        rcc->latency_monitor.timer = NULL;
+    }
     red_channel_client_pipe_add_type(rcc, PIPE_ITEM_TYPE_MIGRATE);
 }
 


More information about the Spice-commits mailing list