# HG changeset patch # User Paul Aurich # Date 1249101144 0 # Node ID 1ff7de15d85696682670b3792143d1bfee56914a # Parent 46e80810b095ca85408715116c88c2ca79fb2afb jabber: Ridiculously verbose logging for BOSH. diff -r 46e80810b095 -r 1ff7de15d856 libpurple/protocols/jabber/bosh.c --- a/libpurple/protocols/jabber/bosh.c Sat Aug 01 04:24:39 2009 +0000 +++ b/libpurple/protocols/jabber/bosh.c Sat Aug 01 04:32:24 2009 +0000 @@ -254,6 +254,19 @@ { int i; + if (purple_debug_is_verbose()) { + for (i = 0; i < MAX_HTTP_CONNECTIONS; ++i) { + PurpleHTTPConnection *httpconn = conn->connections[i]; + if (httpconn == NULL) + purple_debug_misc("jabber", "BOSH %p->connections[%d] = (nil)\n", + conn, i); + else + purple_debug_misc("jabber", "BOSH %p->connections[%d] = %p, state = %d" + ", requests = %d\n", conn, i, httpconn, + httpconn->state, httpconn->requests); + } + } + /* Easy solution: Does everyone involved support pipelining? Hooray! Just use * one TCP connection! */ if (conn->pipelining) @@ -286,6 +299,8 @@ } } + purple_debug_warning("jabber", "Could not find a HTTP connection!\n"); + /* None available. */ return NULL; } @@ -299,7 +314,7 @@ chosen = find_available_http_connection(conn); - if (type != PACKET_NORMAL && !chosen) { + if ((type != PACKET_NORMAL) && !chosen) { /* * For non-ordinary traffic, we can't 'buffer' it, so use the * first connection. @@ -313,6 +328,14 @@ } } + if (type == PACKET_NORMAL) { + if (conn->max_requests > 0 && conn->requests == conn->max_requests) { + purple_debug_warning("jabber", "BOSH connection %p has %d requests out\n", conn, conn->requests); + } else if (!chosen) { + purple_debug_warning("jabber", "No BOSH connection found!\n"); + } + } + if (type == PACKET_NORMAL && (!chosen || (conn->max_requests > 0 && conn->requests == conn->max_requests))) { /* @@ -325,6 +348,10 @@ purple_circ_buffer_append(conn->pending, data, len); } + if (purple_debug_is_verbose()) + purple_debug_misc("jabber", "bosh: %p has %" G_GSIZE_FORMAT " bytes in " + "the buffer.\n", conn, conn->pending->buflen); + return; } @@ -596,6 +623,10 @@ { /* Indicate we're ready and reset some variables */ conn->state = HTTP_CONN_CONNECTED; + if (conn->requests != 0) + purple_debug_error("jabber", "bosh: httpconn %p has %d requests, != 0\n", + conn, conn->requests); + conn->requests = 0; if (conn->read_buf) { g_string_free(conn->read_buf, TRUE); @@ -651,6 +682,12 @@ conn->writeh = 0; } + if (conn->requests > 0 && conn->read_buf->len == 0) { + purple_debug_error("jabber", "bosh: Adjusting BOSHconn requests (%d) to %d\n", + conn->bosh->requests, conn->bosh->requests - conn->requests); + conn->bosh->requests -= conn->requests; + conn->requests = 0; + } if (conn->bosh->pipelining) /* Hmmmm, fall back to multiple connections */ conn->bosh->pipelining = FALSE; @@ -951,6 +988,10 @@ ++conn->requests; ++conn->bosh->requests; + 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); + if (conn->writeh == 0) ret = http_connection_do_send(conn, data, len); else {