pidgin: 2d746b53: Don't try to process BOSH packet if ther...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Fri May 22 01:35:45 EDT 2009


-----------------------------------------------------------------
Revision: 2d746b537f7c15aca747b7df2e1eedb540eb0baf
Ancestor: 70479082260072a56b0aea40ccca311822c17155
Author: darkrain42 at pidgin.im
Date: 2009-05-21T21:09:17
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/2d746b537f7c15aca747b7df2e1eedb540eb0baf

Modified files:
        libpurple/protocols/jabber/bosh.c

ChangeLog: 

Don't try to process BOSH packet if there's no data (avoid a purple_strcasestr assertion).

Also print friendlier error messages.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/bosh.c	d55e085e0957f1ac164ebc6f74ab8251fc48f526
+++ libpurple/protocols/jabber/bosh.c	21caeb2e8ff912502852b10e7911ec725903fdee
@@ -301,7 +301,7 @@ jabber_bosh_connection_send(PurpleBOSHCo
 		return;
 	}
 
-	packet = g_string_new("");
+	packet = g_string_new(NULL);
 
 	g_string_printf(packet, "<body "
 	                "rid='%" G_GUINT64_FORMAT "' "
@@ -488,7 +488,7 @@ static void jabber_bosh_connection_boot(
 }
 
 static void jabber_bosh_connection_boot(PurpleBOSHConnection *conn) {
-	GString *buf = g_string_new("");
+	GString *buf = g_string_new(NULL);
 
 	g_string_printf(buf, "<body content='text/xml; charset=utf-8' "
 	                "secure='true' "
@@ -686,7 +686,7 @@ http_connection_read(PurpleHTTPConnectio
 	int cnt, count = 0;
 
 	if (!conn->buf)
-		conn->buf = g_string_new("");
+		conn->buf = g_string_new(NULL);
 
 	/* Read once to prime cnt before the loop */
 	if (conn->psc)
@@ -705,7 +705,8 @@ http_connection_read(PurpleHTTPConnectio
 
 	if (cnt == 0 || (cnt < 0 && errno != EAGAIN)) {
 		if (cnt < 0)
-			purple_debug_info("jabber", "bosh read=%d, errno=%d\n", cnt, errno);
+			purple_debug_info("jabber", "bosh read=%d, errno=%d, error=%s\n",
+			                  cnt, errno, g_strerror(errno));
 		else
 			purple_debug_info("jabber", "bosh server closed the connection\n");
 
@@ -718,8 +719,8 @@ http_connection_read(PurpleHTTPConnectio
 		/* Process what we do have */
 	}
 
-
-	jabber_bosh_http_connection_process(conn);
+	if (conn->buf->len > 0)
+		jabber_bosh_http_connection_process(conn);
 }
 
 static void


More information about the Commits mailing list