summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2013-05-01 13:04:15 -0400
committerYonit Halperin <yhalperi@redhat.com>2013-05-01 13:04:15 -0400
commitb71ccec83e97d3add619390623db6b0dfd35fdcd (patch)
tree35174e7c3ba56cf2d0967f4458fb2f2c5936826a /server
parentdf2603655202e5f9a7a6b45a2b2b8609128fdf16 (diff)
downloadspice-b71ccec83e97d3add619390623db6b0dfd35fdcd.tar.gz
spice-b71ccec83e97d3add619390623db6b0dfd35fdcd.tar.xz
spice-b71ccec83e97d3add619390623db6b0dfd35fdcd.zip
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).
Diffstat (limited to 'server')
-rw-r--r--server/red_channel.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/server/red_channel.c b/server/red_channel.c
index 4e03d644..9d71543b 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);
}