Mercurial > pidgin
changeset 27174:708f92703a13
Don't try to write when the BOSH connection isn't ready.
This was causing a Connection Refused to turn into a Write Error connection
error because jabber_close() calls jabber_bosh_connection_close().
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Thu, 25 Jun 2009 02:53:26 +0000 |
parents | a9fdf9327652 |
children | afcb1d41e557 |
files | libpurple/protocols/jabber/bosh.c |
diffstat | 1 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/bosh.c Thu Jun 25 02:48:25 2009 +0000 +++ b/libpurple/protocols/jabber/bosh.c Thu Jun 25 02:53:26 2009 +0000 @@ -243,7 +243,7 @@ /* Easy solution: Does everyone involved support pipelining? Hooray! Just use * one TCP connection! */ if (conn->pipelining) - return conn->connections[0]; + return conn->connections[0]->ready ? conn->connections[0] : NULL; /* First loop, look for a connection that's ready */ for (i = 0; i < MAX_HTTP_CONNECTIONS; ++i) { @@ -267,8 +267,8 @@ } static void -jabber_bosh_connection_send(PurpleBOSHConnection *conn, PurpleBOSHPacketType type, - const char *data) +jabber_bosh_connection_send(PurpleBOSHConnection *conn, + PurpleBOSHPacketType type, const char *data) { PurpleHTTPConnection *chosen; GString *packet = NULL; @@ -277,14 +277,16 @@ if (type != PACKET_NORMAL && !chosen) { /* - * For non-ordinary traffic, we don't want to 'buffer' it, so use the first - * connection. + * For non-ordinary traffic, we don't want to 'buffer' it, so use the + * first connection. */ chosen = conn->connections[0]; - if (!chosen->ready) - purple_debug_warning("jabber", "First BOSH connection wasn't ready. Bad " - "things may happen.\n"); + if (!chosen->ready) { + purple_debug_info("jabber", "Unable to find a ready BOSH " + "connection. Ignoring send of type 0x%02x.\n", type); + return; + } } if (type == PACKET_NORMAL && (!chosen ||