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

Submitted by Marc-André Lureau on Aug. 18, 2011, 11:41 p.m.

Details

Message ID 1313685718-20704-1-git-send-email-marcandre.lureau@redhat.com
State New, archived
Headers show

Not browsing as part of any series.

Commit Message

Marc-André Lureau Aug. 18, 2011, 11:41 p.m.
---
 gtk/spice-channel.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

Patch hide | download patch | download mbox

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