[evolution-data-server/camel-socks-proxy] Debug info for read/write/close on the SSL stream



commit 0de310a8b761ee853276b82bc1d191e233ac3fbf
Author: Federico Mena Quintero <federico novell com>
Date:   Wed Jun 2 13:51:20 2010 -0500

    Debug info for read/write/close on the SSL stream
    
    Signed-off-by: Federico Mena Quintero <federico novell com>

 camel/camel-tcp-stream-ssl.c |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c
index fb697bf..3b55c59 100644
--- a/camel/camel-tcp-stream-ssl.c
+++ b/camel/camel-tcp-stream-ssl.c
@@ -415,8 +415,15 @@ static gssize
 stream_read (CamelStream *stream, gchar *buffer, gsize n)
 {
 	CamelTcpStreamSSL *ssl = CAMEL_TCP_STREAM_SSL (stream);
+	gssize result;
 
-	return read_from_prfd (ssl->priv->sockfd, buffer, n);
+	d (g_print ("SSL stream %p: reading %" G_GSIZE_FORMAT " bytes...\n", ssl, n));
+
+	result = read_from_prfd (ssl->priv->sockfd, buffer, n);
+
+	d (g_print ("SSL stream %p: read %" G_GSSIZE_FORMAT " bytes, errno = %d\n", ssl, result, result == -1 ? errno : 0));
+
+	return result;
 }
 
 static gssize
@@ -517,8 +524,15 @@ static gssize
 stream_write (CamelStream *stream, const gchar *buffer, gsize n)
 {
 	CamelTcpStreamSSL *ssl = CAMEL_TCP_STREAM_SSL (stream);
+	gssize result;
+
+	d (g_print ("SSL stream %p: writing %" G_GSIZE_FORMAT " bytes...\n", ssl, n));
 
-	return write_to_prfd (ssl->priv->sockfd, buffer, n);
+	result = write_to_prfd (ssl->priv->sockfd, buffer, n);
+
+	d (g_print ("SSL stream %p: wrote %" G_GSSIZE_FORMAT " bytes, errno = %d\n", ssl, result, result == -1 ? errno : 0));
+
+	return result;
 }
 
 static gint
@@ -531,6 +545,8 @@ stream_flush (CamelStream *stream)
 static gint
 stream_close (CamelStream *stream)
 {
+	d (g_print ("SSL stream %p: closing\n", stream));
+
 	if (((CamelTcpStreamSSL *)stream)->priv->sockfd == NULL) {
 		errno = EINVAL;
 		return -1;
@@ -1248,7 +1264,7 @@ connect_to_socks4_proxy (CamelTcpStreamSSL *ssl, const gchar *proxy_host, gint p
 
 	g_assert (proxy_host != NULL);
 
-	d (g_print ("SSL: connecting to SOCKS4 proxy %s:%d {\n  resolving proxy host\n", proxy_host, proxy_port));
+	d (g_print ("SSL stream %p: connecting to SOCKS4 proxy %s:%d {\n  resolving proxy host\n", ssl, proxy_host, proxy_port));
 
 	sprintf (serv, "%d", proxy_port);
 



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