summaryrefslogtreecommitdiff
path: root/gtk/channel-base.c
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2012-08-25 23:20:21 +0300
committerMarc-André Lureau <marcandre.lureau@redhat.com>2012-08-28 18:36:28 +0200
commit202cdd9d8a8e0a08326c44c0ad75997f026bda84 (patch)
tree03ae0eb37b602c2449537cfbdd4b2f54e23de5d1 /gtk/channel-base.c
parentc22a53f4ebd078c37ef014a160ce30b604b55582 (diff)
seamless migration: transfer pending msgs to the destination, instead of sending them to the src before FLUSH_MARK
In order to save migration time, and probably also decrease migration data size, we push the flush mark to the src server before any other message. All the other pending msgs will be sent later to the destination server (see next patch).
Diffstat (limited to 'gtk/channel-base.c')
-rw-r--r--gtk/channel-base.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gtk/channel-base.c b/gtk/channel-base.c
index 2968f42..fa39761 100644
--- a/gtk/channel-base.c
+++ b/gtk/channel-base.c
@@ -157,12 +157,14 @@ void spice_channel_handle_migrate(SpiceChannel *channel, SpiceMsgIn *in)
SPICE_DEBUG("%s: channel %s flags %u", __FUNCTION__, c->name, mig->flags);
if (mig->flags & SPICE_MIGRATE_NEED_FLUSH) {
- /* iterate_write is blocking and flushing all pending write */
- SPICE_CHANNEL_GET_CLASS(channel)->iterate_write(channel);
-
+ /* if peer version > 1: pushing the mark msg before all other messgages and sending it,
+ * and only it */
+ if (c->peer_hdr.major_version == 1) {
+ /* iterate_write is blocking and flushing all pending write */
+ SPICE_CHANNEL_GET_CLASS(channel)->iterate_write(channel);
+ }
out = spice_msg_out_new(SPICE_CHANNEL(channel), SPICE_MSGC_MIGRATE_FLUSH_MARK);
spice_msg_out_send_internal(out);
- SPICE_CHANNEL_GET_CLASS(channel)->iterate_write(channel);
}
if (mig->flags & SPICE_MIGRATE_NEED_DATA_TRANSFER) {
spice_channel_recv_msg(channel, get_msg_handler, &data);
@@ -175,8 +177,10 @@ void spice_channel_handle_migrate(SpiceChannel *channel, SpiceMsgIn *in)
}
}
+ /* swapping channels sockets */
spice_session_channel_migrate(c->session, channel);
+ /* pushing the MIGRATE_DATA before all other pending messages */
if ((mig->flags & SPICE_MIGRATE_NEED_DATA_TRANSFER) && (data != NULL)) {
out = spice_msg_out_new(SPICE_CHANNEL(channel), SPICE_MSGC_MIGRATE_DATA);
spice_marshaller_add(out->marshaller, data->data,