[Spice-devel] [PATCH spice-gtk 12/13] migration: don't check socket error

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


During migration, the original socket is closed before coroutine
finishes, so it's not guarantee to have c->sock on errors.
---
 gtk/spice-channel.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index 9375c68..571eeb1 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -2140,6 +2140,10 @@ static gboolean spice_channel_iterate(SpiceChannel *channel)
 
     if (c->has_error) {
         GIOCondition ret;
+
+        if (!c->sock)
+            return FALSE;
+
         /* We don't want to report an error if the socket was closed gracefully
          * on the other end (VM shutdown) */
         ret = g_socket_condition_check(c->sock, G_IO_IN | G_IO_ERR | G_IO_HUP);
@@ -2544,6 +2548,7 @@ static void channel_reset(SpiceChannel *channel, gboolean migrating)
 {
     SpiceChannelPrivate *c = channel->priv;
 
+    CHANNEL_DEBUG(channel, "channel reset");
     if (c->connect_delayed_id) {
         g_source_remove(c->connect_delayed_id);
         c->connect_delayed_id = 0;
@@ -2610,6 +2615,7 @@ static void channel_reset(SpiceChannel *channel, gboolean migrating)
 G_GNUC_INTERNAL
 void spice_channel_reset(SpiceChannel *channel, gboolean migrating)
 {
+    CHANNEL_DEBUG(channel, "reset %s", migrating ? "migrating" : "");
     SPICE_CHANNEL_GET_CLASS(channel)->channel_reset(channel, migrating);
 }
 
-- 
1.9.3



More information about the Spice-devel mailing list