[Spice-devel] [spice-gtk v1 1/4] spice-channel: Properly error out if reconnect fails

Victor Toso victortoso at redhat.com
Thu Sep 6 14:13:10 UTC 2018


From: Victor Toso <me at victortoso.com>

The channel_connect() function could fail leading to a spice-channel
existing as zombie (its coroutine return soon after).

Check if channel_connect() fails and give a proper error signal to
user when that happens.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1625550
Signed-off-by: Victor Toso <victortoso at redhat.com>
---
 src/spice-channel.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/spice-channel.c b/src/spice-channel.c
index 0a5437c..48e3265 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -2675,8 +2675,12 @@ cleanup:
     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);
+        if (channel_connect(channel, c->tls)) {
+            g_object_unref(channel);
+        } else {
+            c->event = SPICE_CHANNEL_ERROR_CONNECT;
+            g_idle_add(spice_channel_delayed_unref, data);
+        }
     } else
         g_idle_add(spice_channel_delayed_unref, data);
 
-- 
2.17.1



More information about the Spice-devel mailing list