[spice-gtk 3/3] session: Add more debugging logs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Initial SPICE connection can sometimes fail without clear indications
where/how it failed. This commit adds more debug logs/more accurate logs
in order to help narrow down such issues.
---
 gtk/spice-session.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/gtk/spice-session.c b/gtk/spice-session.c
index 7f15d98..a62d533 100644
--- a/gtk/spice-session.c
+++ b/gtk/spice-session.c
@@ -1924,10 +1924,12 @@ static void socket_client_connect_ready(GObject *source_object, GAsyncResult *re
     spice_open_host *open_host = data;
     GSocketConnection *connection = NULL;
 
-    SPICE_DEBUG("connect ready");
+    CHANNEL_DEBUG(open_host->channel, "connect ready");
     connection = g_socket_client_connect_finish(client, result, &open_host->error);
-    if (connection == NULL)
+    if (connection == NULL) {
+        g_warn_if_fail(open_host->error != NULL);
         goto end;
+    }
 
     open_host->connection = connection;
 
@@ -1938,7 +1940,7 @@ end:
 /* main context */
 static void open_host_connectable_connect(spice_open_host *open_host, GSocketConnectable *connectable)
 {
-    SPICE_DEBUG("connecting %p...", open_host);
+    CHANNEL_DEBUG(open_host->channel, "connecting %p...", open_host);
 
     g_socket_client_connect_async(open_host->client, connectable,
                                   open_host->cancellable,
@@ -2065,8 +2067,10 @@ GSocketConnection* spice_session_channel_open_host(SpiceSession *session, SpiceC
         }
     } else {
         port = *use_tls ? s->tls_port : s->port;
-        if (port == NULL)
+        if (port == NULL) {
+            g_warning("Missing port value (use_tls: %d)", *use_tls);
             return NULL;
+        }
 
         open_host.port = strtol(port, &endptr, 10);
         if (*port == '\0' || *endptr != '\0' ||
@@ -2075,6 +2079,11 @@ GSocketConnection* spice_session_channel_open_host(SpiceSession *session, SpiceC
             return NULL;
         }
     }
+    if (*use_tls) {
+        CHANNEL_DEBUG(channel, "Using TLS, port %d", open_host.port);
+    } else {
+        CHANNEL_DEBUG(channel, "Using plain text, port %d", open_host.port);
+    }
 
     open_host.client = g_socket_client_new();
     g_socket_client_set_timeout(open_host.client, SOCKET_TIMEOUT);
@@ -2084,7 +2093,7 @@ GSocketConnection* spice_session_channel_open_host(SpiceSession *session, SpiceC
     coroutine_yield(NULL);
 
     if (open_host.error != NULL) {
-        SPICE_DEBUG("open host: %s", open_host.error->message);
+        CHANNEL_DEBUG(channel, "open host: %s", open_host.error->message);
         g_propagate_error(error, open_host.error);
     } else if (open_host.connection != NULL) {
         GSocket *socket;
-- 
2.1.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]