<div dir="ltr">Following first review thread, comment is updated with <br><br>During migration, the main channel coroutine initiating the process is waiting<br><span>
</span>for connection completion of all channels. migrate_channel_event_cb() yields<br>back to the main channel coroutine once all channels have completed connection,<div class=""><div id=":jee" class="" tabindex="0"><img class="" src="https://ssl.gstatic.com/ui/v1/icons/mail/images/cleardot.gif">or it will abort migration for unexpected channel events, such as<br></div></div><span class="im">SPICE_CHANNEL_CLOSED</span><br>...<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 14, 2014 at 12:32 AM, Marc-André Lureau <span dir="ltr"><<a href="mailto:marcandre.lureau@redhat.com" target="_blank">marcandre.lureau@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">During migration, the main channel initiating the process is waiting on<br>
connection completion of all channels in migrate_channel_event_cb() or<br>
it will abort migration for unexpected channel events, such as<br>
SPICE_CHANNEL_CLOSED.<br>
<br>
If the migration is cancelled before connection completes, but the<br>
channels state are still in the SPICE_CHANNEL_STATE_UNCONNECTED state,<br>
no events will be emitted in channel_disconnect(), and the source<br>
session main channel will remain frozen waiting for migration completion<br>
or failure.<br>
<br>
Currently, for client-fd channels, the channel state remains UNCONNECTED<br>
until the fd is provided. But if cancellation occurs, no channel events<br>
are emitted and the source session is stuck.<br>
<br>
Before requesting the fd, set the channel state to connecting, so it<br>
will emit an error if disconnect happens, and it will finish cancelling<br>
the migration in source session main channel.<br>
---<br>
 gtk/spice-channel.c | 13 ++++++++-----<br>
 1 file changed, 8 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c<br>
index f59127e..3966560 100644<br>
--- a/gtk/spice-channel.c<br>
+++ b/gtk/spice-channel.c<br>
@@ -2461,10 +2461,8 @@ static gboolean channel_connect(SpiceChannel *channel)<br>
         g_warning("%s: channel setup incomplete", __FUNCTION__);<br>
         return false;<br>
     }<br>
-    if (c->state != SPICE_CHANNEL_STATE_UNCONNECTED) {<br>
-        g_warning("Invalid channel_connect state: %d", c->state);<br>
-        return true;<br>
-    }<br>
+<br>
+    c->state = SPICE_CHANNEL_STATE_CONNECTING;<br>
<br>
     if (spice_session_get_client_provided_socket(c->session)) {<br>
         if (c->fd == -1) {<br>
@@ -2476,7 +2474,7 @@ static gboolean channel_connect(SpiceChannel *channel)<br>
             return true;<br>
         }<br>
     }<br>
-    c->state = SPICE_CHANNEL_STATE_CONNECTING;<br>
+<br>
     c->xmit_queue_blocked = FALSE;<br>
<br>
     g_return_val_if_fail(c->sock == NULL, FALSE);<br>
@@ -2532,6 +2530,11 @@ gboolean spice_channel_open_fd(SpiceChannel *channel, int fd)<br>
     g_return_val_if_fail(fd >= -1, FALSE);<br>
<br>
     c = channel->priv;<br>
+    if (c->state > SPICE_CHANNEL_STATE_CONNECTING) {<br>
+        g_warning("Invalid channel_connect state: %d", c->state);<br>
+        return true;<br>
+    }<br>
+<br>
     c->fd = fd;<br>
<br>
     return channel_connect(channel);<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.9.3<br>
<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Marc-André Lureau</div>
</div>