From f7d3140303e37ad8b7abffc6c39498af4f2a4710 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 27 Sep 2012 17:29:37 +0200 Subject: [PATCH 03/21] Set channel state before calling channel_reset This way functions called from the channel_reset function can rely on state accurately reflecting the state. This is necessary to stop channel-usbredir's reset callback from trying to send the initial hello message while the channel is no longer in a connected state. Signed-off-by: Hans de Goede Resolves: rhbz#861332 --- gtk/spice-channel.c | 2 +- gtk/spice-session.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c index dee0fa3..c5e8d9f 100644 --- a/gtk/spice-channel.c +++ b/gtk/spice-channel.c @@ -2428,10 +2428,10 @@ static void channel_disconnect(SpiceChannel *channel) if (c->state == SPICE_CHANNEL_STATE_READY) emit_main_context(channel, SPICE_CHANNEL_EVENT, SPICE_CHANNEL_CLOSED); + c->state = SPICE_CHANNEL_STATE_UNCONNECTED; spice_channel_reset(channel, FALSE); g_return_if_fail(SPICE_IS_CHANNEL(channel)); - c->state = SPICE_CHANNEL_STATE_UNCONNECTED; } /** diff --git a/gtk/spice-session.c b/gtk/spice-session.c index 68d1594..28ebe8a 100644 --- a/gtk/spice-session.c +++ b/gtk/spice-session.c @@ -1388,15 +1388,17 @@ void spice_session_migrate_end(SpiceSession *self) SpiceChannel *channel = l->data; l = l->next; + if (!SPICE_IS_MAIN_CHANNEL(channel)) { + /* freeze other channels */ + channel->priv->state = SPICE_CHANNEL_STATE_MIGRATING; + } + /* reset for migration, disconnect */ spice_channel_reset(channel, TRUE); if (SPICE_IS_MAIN_CHANNEL(channel)) { /* migrate main to target, so we can start talking */ spice_session_channel_migrate(self, channel); - } else { - /* freeze other channels */ - channel->priv->state = SPICE_CHANNEL_STATE_MIGRATING; } } -- 1.7.12.1