[Spice-devel] [PATCH spice-gtk 13/13] migration: delay switch host reconnect

Marc-André Lureau marcandre.lureau at redhat.com
Sun Nov 9 08:31:45 PST 2014


Wait until the main channel is reset() before initiating a reconnect.

With the added precondition checks in previous patch, we hit the
following critical otherwise:

(remote-viewer:4617): GSpice-CRITICAL **: channel_connect: assertion
'c->sock == NULL' failed
---
 gtk/channel-main.c  | 3 ---
 gtk/spice-channel.c | 6 ++++++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 18fa0a0..30f6d6c 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -2272,9 +2272,6 @@ static gboolean switch_host_delayed(gpointer data)
     spice_channel_disconnect(channel, SPICE_CHANNEL_SWITCHING);
     spice_session_switching_disconnect(session);
 
-    spice_channel_connect(channel);
-    spice_session_set_migration_state(session, SPICE_SESSION_MIGRATION_NONE);
-
     return FALSE;
 }
 
diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index 571eeb1..b0a2ad6 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -2638,6 +2638,12 @@ static void channel_disconnect(SpiceChannel *channel)
     spice_channel_reset(channel, FALSE);
 
     g_return_if_fail(SPICE_IS_CHANNEL(channel));
+
+    if (c->state == SPICE_CHANNEL_STATE_SWITCHING) {
+        spice_channel_connect(channel);
+        spice_session_set_migration_state(spice_channel_get_session(channel),
+                                          SPICE_SESSION_MIGRATION_NONE);
+    }
 }
 
 /**
-- 
1.9.3



More information about the Spice-devel mailing list