[Spice-devel] [spice-gtk 1/2] spice_channel_coroutine: emit signals in all error cases

Christophe Fergeau cfergeau at redhat.com
Mon Jun 11 02:17:19 PDT 2012


There are several very unlikely failures where no signal is emitted
to indicate the failure. Since applications rely on these signals
to detect spice-gtk connection failures, it's important to emit
one in all error cases.
---
 gtk/spice-channel.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index 4cac8ce..fd63ca0 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -2100,11 +2100,13 @@ static void *spice_channel_coroutine(void *data)
     if (spice_session_get_client_provided_socket(c->session)) {
         if (c->fd < 0) {
             g_critical("fd not provided!");
+            emit_main_context(channel, SPICE_CHANNEL_EVENT, SPICE_CHANNEL_ERROR_CONNECT);
             goto cleanup;
         }
 
         if (!(c->sock = g_socket_new_from_fd(c->fd, NULL))) {
                 SPICE_DEBUG("Failed to open socket from fd %d", c->fd);
+                emit_main_context(channel, SPICE_CHANNEL_EVENT, SPICE_CHANNEL_ERROR_CONNECT);
                 return FALSE;
         }
 
@@ -2133,6 +2135,7 @@ reconnect:
         c->ctx = SSL_CTX_new(TLSv1_method());
         if (c->ctx == NULL) {
             g_critical("SSL_CTX_new failed");
+            emit_main_context(channel, SPICE_CHANNEL_EVENT, SPICE_CHANNEL_ERROR_TLS);
             goto cleanup;
         }
 
@@ -2169,6 +2172,7 @@ reconnect:
         c->ssl = SSL_new(c->ctx);
         if (c->ssl == NULL) {
             g_critical("SSL_new failed");
+            emit_main_context(channel, SPICE_CHANNEL_EVENT, SPICE_CHANNEL_ERROR_TLS);
             goto cleanup;
         }
 
-- 
1.7.10.2



More information about the Spice-devel mailing list