diff options
author | Yonit Halperin <yhalperi@redhat.com> | 2012-08-25 23:20:20 +0300 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2012-08-28 18:36:28 +0200 |
commit | c22a53f4ebd078c37ef014a160ce30b604b55582 (patch) | |
tree | 300cffedfd64da8d2b6d910142e9f1954776dd43 /gtk/spice-channel.c | |
parent | cf5486773d466d84b3f0c3444cfa7500e97cf16c (diff) |
seamless migration: src and dest servers handshake
Flow:
(1) *src* main channel coroutine (main_handle_migrate_begin_seamless):
handles SPICE_MSG_MAIN_MIGRATE_BEGIN_SEAMLESS; yields to the main loop,
supplying it the destination information needed for connection.
(2) main context (migrate_connect):
Establishes a new session for connecting to the destination.
After all the channels are opened (async), their state, except for
the one of the main channel, is modified to
SPICE_CHANNEL_STATE_MIGRATING (see migrate_channel_event_cb);
no reading is done from the channel during this state.
The dest main channel's state is changed to SPICE_CHANNEL_STATE_MIGRATION_HANDSHAKE
(3) *dest* main channel coroutine: sends to the dest server SPICE_MSGC_MAIN_MIGRATE_DST_DO_SEAMLESS
(see spice_channel_recv_auth)
(4) *dest* main channel coroutine: recevices SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_ACK/NACK.
adds main_migrate_handshake_done to the main loop.
(5) main context: when all the dest session channels are connected, and the main channel handshake
is done, we yield to the src main channel coroutine (see
migrate_channel_event_cb and main_migrate_handshake_done)
(6) *src* main channel coroutine: sends to the src server
SPICE_MSGC_MAIN_MIGRATE_(CONNECTED|CONNECTED_SEAMLESS|CONNECT_ERROR)
For more details see spice-protocol. commit
1ad5d259cb4b695ec3106de7ccd082e031e7ae11
Diffstat (limited to 'gtk/spice-channel.c')
-rw-r--r-- | gtk/spice-channel.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c index 54d406d..5f37cbc 100644 --- a/gtk/spice-channel.c +++ b/gtk/spice-channel.c @@ -49,6 +49,7 @@ static void spice_channel_send_link(SpiceChannel *channel); static void channel_disconnect(SpiceChannel *channel); static void channel_reset(SpiceChannel *channel, gboolean migrating); static void spice_channel_reset_capabilities(SpiceChannel *channel); +static void spice_channel_send_migration_handshake(SpiceChannel *channel); /** * SECTION:spice-channel @@ -1080,6 +1081,10 @@ static void spice_channel_recv_auth(SpiceChannel *channel) emit_main_context(channel, SPICE_CHANNEL_EVENT, SPICE_CHANNEL_OPENED); + if (c->state == SPICE_CHANNEL_STATE_MIGRATION_HANDSHAKE) { + spice_channel_send_migration_handshake(channel); + } + if (c->state != SPICE_CHANNEL_STATE_MIGRATING) spice_channel_up(channel); } @@ -2002,6 +2007,7 @@ static void spice_channel_iterate_read(SpiceChannel *channel) spice_channel_recv_auth(channel); break; case SPICE_CHANNEL_STATE_READY: + case SPICE_CHANNEL_STATE_MIGRATION_HANDSHAKE: spice_channel_recv_msg(channel, (handler_msg_in)SPICE_CHANNEL_GET_CLASS(channel)->handle_msg, NULL); break; @@ -2654,3 +2660,14 @@ static void spice_channel_reset_capabilities(SpiceChannel *channel) SPICE_CHANNEL_GET_CLASS(channel)->channel_reset_capabilities(channel); } } + +static void spice_channel_send_migration_handshake(SpiceChannel *channel) +{ + SpiceChannelPrivate *c = SPICE_CHANNEL_GET_PRIVATE(channel); + + if (SPICE_CHANNEL_GET_CLASS(channel)->channel_send_migration_handshake) { + SPICE_CHANNEL_GET_CLASS(channel)->channel_send_migration_handshake(channel); + } else { + c->state = SPICE_CHANNEL_STATE_MIGRATING; + } +} |