[Spice-devel] [PATCH] gtk/channel: emit more channel error conditions

Marc-André Lureau marcandre.lureau at gmail.com
Thu Aug 18 09:41:58 PDT 2011


---
 gtk/spice-channel.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index f8c79eb..05764e3 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -545,6 +545,7 @@ static void do_emit_main_context(GObject *object, int signum, gpointer params)
     switch (signum) {
     case SPICE_CHANNEL_EVENT: {
         struct SPICE_CHANNEL_EVENT *p = params;
+        SPICE_DEBUG("channel event: %d", p->event);
         g_signal_emit(object, signals[signum], 0, p->event);
         break;
     }
@@ -1882,6 +1883,7 @@ 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_IO);
             goto cleanup;
         }
 
@@ -1916,6 +1918,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;
         }
 
@@ -1934,8 +1937,10 @@ reconnect:
                 if (verify & SPICE_SESSION_VERIFY_PUBKEY) {
                     g_warning("only pubkey active");
                     verify = SPICE_SESSION_VERIFY_PUBKEY;
-                } else
+                } else {
+                    emit_main_context(channel, SPICE_CHANNEL_EVENT, SPICE_CHANNEL_ERROR_TLS);
                     goto cleanup;
+                }
             }
         }
 
@@ -1951,11 +1956,13 @@ 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;
         }
         rc = SSL_set_fd(c->ssl, g_socket_get_fd(c->sock));
         if (rc <= 0) {
             g_critical("SSL_set_fd failed");
+            emit_main_context(channel, SPICE_CHANNEL_EVENT, SPICE_CHANNEL_ERROR_TLS);
             goto cleanup;
         }
 
-- 
1.7.6



More information about the Spice-devel mailing list