changeset 31580:b7e2cddaac7a

jabber: Improved BOSH logging some. Refs #13008
author Paul Aurich <paul@darkrain42.org>
date Mon, 10 Jan 2011 01:28:31 +0000
parents 14a36bcf6704
children dbd0012e72cb
files libpurple/protocols/jabber/bosh.c
diffstat 1 files changed, 18 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/bosh.c	Mon Jan 10 00:39:53 2011 +0000
+++ b/libpurple/protocols/jabber/bosh.c	Mon Jan 10 01:28:31 2011 +0000
@@ -300,8 +300,9 @@
 	/* Third loop, look for one that's NULL and create a new connection */
 	for (i = 0; i < NUM_HTTP_CONNECTIONS; ++i) {
 		if (!conn->connections[i]) {
-			purple_debug_info("jabber", "bosh: Creating and connecting new httpconn\n");
 			conn->connections[i] = jabber_bosh_http_connection_init(conn);
+			purple_debug_info("jabber", "bosh: Creating and connecting new httpconn "
+			                            "(%i, %p)\n", i, conn->connections[i]);
 
 			http_connection_connect(conn->connections[i]);
 			return NULL;
@@ -675,6 +676,11 @@
 		if (conn->bosh->connections[1] == NULL) {
 			conn->bosh->connections[1] = jabber_bosh_http_connection_init(conn->bosh);
 			http_connection_connect(conn->bosh->connections[1]);
+		} else {
+			/* Shouldn't happen; this should be the only place pipelining
+			 * is turned off.
+			 */
+			g_warn_if_reached();
 		}
 	}
 
@@ -791,10 +797,11 @@
 
 	if (cnt == 0 || (cnt < 0 && errno != EAGAIN)) {
 		if (cnt < 0)
-			purple_debug_info("jabber", "bosh read=%d, errno=%d, error=%s\n",
-			                  cnt, errno, g_strerror(errno));
+			purple_debug_info("jabber", "BOSH (%p) read=%d, errno=%d, error=%s\n",
+			                  conn, cnt, errno, g_strerror(errno));
 		else
-			purple_debug_info("jabber", "bosh server closed the connection\n");
+			purple_debug_info("jabber", "BOSH server closed the connection (%p)\n",
+			                  conn);
 
 		/*
 		 * If the socket is closed, the processing really needs to know about
@@ -911,6 +918,9 @@
 	else
 		ret = write(conn->fd, data, len);
 
+	if (purple_debug_is_verbose())
+		purple_debug_misc("jabber", "BOSH (%p): wrote %d bytes\n", conn, ret);
+
 	return ret;
 }
 
@@ -975,7 +985,10 @@
 
 	if (purple_debug_is_unsafe() && purple_debug_is_verbose())
 		/* Will contain passwords for SASL PLAIN and is verbose */
-		purple_debug_misc("jabber", "BOSH: Sending %s\n", data);
+		purple_debug_misc("jabber", "BOSH (%p): Sending %s\n", conn, data);
+	else if (purple_debug_is_verbose())
+		purple_debug_misc("jabber", "BOSH (%p): Sending request of "
+		                            "%" G_GSIZE_FORMAT "bytes.", conn, len);
 
 	if (conn->writeh == 0)
 		ret = http_connection_do_send(conn, data, len);