[glib-networking/wip/openssl] To be removed: add debug messages



commit e1a97a80028a5475047294067d85fb84821a8106
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Wed Jan 20 11:20:22 2016 +0100

    To be removed: add debug messages

 tls/openssl/gtlsconnection-openssl.c |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)
---
diff --git a/tls/openssl/gtlsconnection-openssl.c b/tls/openssl/gtlsconnection-openssl.c
index 3792ccd..0607f55 100644
--- a/tls/openssl/gtlsconnection-openssl.c
+++ b/tls/openssl/gtlsconnection-openssl.c
@@ -163,13 +163,15 @@ end_openssl_io (GTlsConnectionOpenssl  *openssl,
   return G_TLS_CONNECTION_BASE_ERROR;
 }
 
-#define BEGIN_OPENSSL_IO(openssl, direction, blocking, cancellable)        \
+#define BEGIN_OPENSSL_IO(openssl, direction, blocking, cancellable, operation)        \
+  g_message("start: %s", operation); \
   g_tls_connection_base_push_io (G_TLS_CONNECTION_BASE (openssl),        \
                                  direction, blocking, cancellable);        \
   do {
 
-#define END_OPENSSL_IO(openssl, direction, ret, status, errmsg, err)        \
+#define END_OPENSSL_IO(openssl, direction, ret, status, errmsg, err, operation)        \
     status = end_openssl_io (openssl, direction, ret, err, errmsg, ERR_error_string (SSL_get_error (ssl, 
ret), NULL)); \
+    g_message("end: %s", operation); \
   } while (status == G_TLS_CONNECTION_BASE_TRY_AGAIN);
 
 static GTlsConnectionBaseStatus
@@ -193,10 +195,10 @@ g_tls_connection_openssl_request_rehandshake (GTlsConnectionBase  *tls,
 
   ssl = g_tls_connection_openssl_get_ssl (openssl);
 
-  BEGIN_OPENSSL_IO (openssl, G_IO_IN | G_IO_OUT, TRUE, cancellable);
+  BEGIN_OPENSSL_IO (openssl, G_IO_IN | G_IO_OUT, TRUE, cancellable, "request rehandshake");
   ret = SSL_renegotiate (ssl);
   END_OPENSSL_IO (openssl, G_IO_IN | G_IO_OUT, ret, status,
-                  _("Error performing TLS handshake: %s"), error);
+                  _("Error performing TLS handshake: %s"), error, "request rehandshake");
 
   return status;
 }
@@ -289,10 +291,10 @@ g_tls_connection_openssl_handshake (GTlsConnectionBase  *tls,
 
   ssl = g_tls_connection_openssl_get_ssl (openssl);
 
-  BEGIN_OPENSSL_IO (openssl, G_IO_IN | G_IO_OUT, TRUE, cancellable);
+  BEGIN_OPENSSL_IO (openssl, G_IO_IN | G_IO_OUT, TRUE, cancellable, "rehandshake");
   ret = SSL_do_handshake (ssl);
   END_OPENSSL_IO (openssl, G_IO_IN | G_IO_OUT, ret, status,
-                  _("Error performing TLS handshake: %s"), error);
+                  _("Error performing TLS handshake: %s"), error, "rehandshake");
 
   if (ret > 0)
     {
@@ -412,10 +414,10 @@ g_tls_connection_openssl_read (GTlsConnectionBase    *tls,
 
   ssl = g_tls_connection_openssl_get_ssl (openssl);
 
-  BEGIN_OPENSSL_IO (openssl, G_IO_IN, blocking, cancellable);
+  BEGIN_OPENSSL_IO (openssl, G_IO_IN, blocking, cancellable, "read");
   ret = SSL_read (ssl, buffer, count);
   END_OPENSSL_IO (openssl, G_IO_IN, ret, status,
-                  _("Error reading data from TLS socket: %s"), error);
+                  _("Error reading data from TLS socket: %s"), error, "read");
 
   if (ret >= 0)
     *nread = ret;
@@ -438,10 +440,10 @@ g_tls_connection_openssl_write (GTlsConnectionBase    *tls,
 
   ssl = g_tls_connection_openssl_get_ssl (openssl);
 
-  BEGIN_OPENSSL_IO (openssl, G_IO_OUT, blocking, cancellable);
+  BEGIN_OPENSSL_IO (openssl, G_IO_OUT, blocking, cancellable, "write");
   ret = SSL_write (ssl, buffer, count);
   END_OPENSSL_IO (openssl, G_IO_OUT, ret, status,
-                  _("Error writing data to TLS socket: %s"), error);
+                  _("Error writing data to TLS socket: %s"), error, "write");
 
   if (ret >= 0)
     *nwrote = ret;
@@ -464,10 +466,10 @@ g_tls_connection_openssl_close (GTlsConnectionBase  *tls,
 
   priv->shutting_down = TRUE;
 
-  BEGIN_OPENSSL_IO (openssl, G_IO_IN | G_IO_OUT, TRUE, cancellable);
+  BEGIN_OPENSSL_IO (openssl, G_IO_IN | G_IO_OUT, TRUE, cancellable, "close");
   ret = SSL_shutdown (ssl);
   END_OPENSSL_IO (openssl, G_IO_IN | G_IO_OUT, ret, status,
-                  _("Error performing TLS close: %s"), error);
+                  _("Error performing TLS close: %s"), error, "close");
 
   return status;
 }


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