# HG changeset patch # User Paul Aurich # Date 1245898406 0 # Node ID 708f92703a13b08b5baaaed8cda22a9f97132fa0 # Parent a9fdf932765238ee41d4dd42fca47ea335caf491 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(). diff -r a9fdf9327652 -r 708f92703a13 libpurple/protocols/jabber/bosh.c --- 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 ||