[Spice-commits] 2 commits - gtk/spice-channel.c

Christophe Fergau teuf at kemper.freedesktop.org
Mon Jun 11 02:44:43 PDT 2012


 gtk/spice-channel.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit e463f252f1c474cb36019b794e6aa41aa7028d10
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Mon Jun 11 11:13:06 2012 +0200

    spice_channel_coroutine: fix function exit in error path
    
    spice_channel_coroutine returns a void *, but one of its error path
    is doing 'return FALSE'. This commit replaces this return with a
    'goto cleanup' since this is what is done in the other error paths.

diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index fd63ca0..851fc23 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -2107,7 +2107,7 @@ static void *spice_channel_coroutine(void *data)
         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;
+                goto cleanup;
         }
 
         g_socket_set_blocking(c->sock, FALSE);
commit b65b510ef88f41b3bdd986d98f4cf538d7dd3817
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Mon Jun 11 11:09:50 2012 +0200

    spice_channel_coroutine: emit signals in all error cases
    
    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.

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;
         }
 


More information about the Spice-commits mailing list