summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2015-01-27 16:58:40 +0100
committerChristophe Fergeau <cfergeau@redhat.com>2015-01-29 17:11:54 +0100
commit315c1a5e668c6e31f69fa37699f9db13326a4e11 (patch)
tree7cddacdb59da49c4c021c8b11ab8d94cea39e0f5
parent10418e6a6bcdcd2cec835f0b09442bcf0db9b338 (diff)
session: Add more debugging logs
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.
-rw-r--r--gtk/spice-session.c19
1 files 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;