[Spice-devel] [PATCH spice-gtk v2 14/19] migration: delay switch host reconnect

Marc-André Lureau marcandre.lureau at redhat.com
Thu Nov 13 15:32:37 PST 2014


The following critical happens on switch-host:

(remote-viewer:4617): GSpice-CRITICAL **: channel_connect: assertion
'c->sock == NULL' failed

The critical happens since the main channel reset code calls
set_agent_connected(), which will yield to main loop, so reconnection
can't happen after calling spice_hannel_disconnect(), and must wait
until the channel reset completes.
---
 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 e86fc15..6d06ee3 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 115efda..94f980f 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -2639,6 +2639,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