[Spice-devel] [PATCH spice-gtk 4/9] channel: use exisiting reconnection code when switching

Marc-André Lureau marcandre.lureau at redhat.com
Mon Feb 16 09:02:25 PST 2015


Switching for migration reason is similar to a reconnection during
initial connection.

A notable difference is that new code path doesn't schedule a
delayed_unref callback. This is fine since the channel is still running
and delayed_unref is mainly used for signaling disconnections and none
should be emitted when switching.
---
 gtk/spice-channel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index e3c4299..f036105 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -2437,7 +2437,8 @@ cleanup:
 
     SPICE_CHANNEL_GET_CLASS(channel)->channel_disconnect(channel);
 
-    if (c->state == SPICE_CHANNEL_STATE_RECONNECTING) {
+    if (c->state == SPICE_CHANNEL_STATE_RECONNECTING ||
+        c->state == SPICE_CHANNEL_STATE_SWITCHING) {
         g_warn_if_fail(c->event == SPICE_CHANNEL_NONE);
         channel_connect(channel, c->tls);
         g_object_unref(channel);
@@ -2655,7 +2656,6 @@ static void channel_disconnect(SpiceChannel *channel)
     g_return_if_fail(SPICE_IS_CHANNEL(channel));
 
     if (c->state == SPICE_CHANNEL_STATE_SWITCHING) {
-        channel_connect(channel, c->tls);
         spice_session_set_migration_state(spice_channel_get_session(channel),
                                           SPICE_SESSION_MIGRATION_NONE);
     }
-- 
2.1.0



More information about the Spice-devel mailing list