changeset 31538:e1d31abb245c

bonjour: Update to 427f3622bbeb4 to match the last used IP more reliably. Without this, there will be an infinite loop when there are duplicate IPs in the list for a buddy (e.g. when you receive notifications on multiple interfaces). Refs #13773
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 03 May 2011 16:37:16 +0000
parents 6ec53e134447
children 5ec6859bf81a
files libpurple/protocols/bonjour/jabber.c libpurple/protocols/bonjour/jabber.h
diffstat 2 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/jabber.c	Tue May 03 16:12:36 2011 +0000
+++ b/libpurple/protocols/bonjour/jabber.c	Tue May 03 16:37:16 2011 +0000
@@ -836,8 +836,14 @@
 		purple_debug_error("bonjour", "Error connecting to buddy %s at %s:%d (%s); Trying next IP address\n",
 				   purple_buddy_get_name(pb), bb->conversation->ip, bb->port_p2pj, error);
 
-		for (; strcmp(bb->conversation->ip, tmp->data) != 0; tmp = g_slist_next(tmp));
-		tmp = g_slist_next(tmp);
+		/* There may be multiple entries for the same IP - one per
+		 * presence recieved (e.g. multiple interfaces).
+		 * We need to make sure that we find the previously used entry.
+		 */
+		while (tmp && bb->conversation->ip_link != tmp->data)
+			tmp = g_slist_next(tmp);
+		if (tmp)
+			tmp = g_slist_next(tmp);
 
 		account = purple_buddy_get_account(pb);
 
@@ -845,7 +851,7 @@
 			const gchar *ip;
 			PurpleProxyConnectData *connect_data;
 
-			ip = tmp->data;
+			bb->conversation->ip_link = ip = tmp->data;
 
 			purple_debug_info("bonjour", "Starting conversation with %s at %s:%d\n",
 					  purple_buddy_get_name(pb), ip, bb->port_p2pj);
@@ -1047,6 +1053,7 @@
 
 		bb->conversation = bonjour_jabber_conv_new(pb, jdata->account, ip);
 		bb->conversation->connect_data = connect_data;
+		bb->conversation->ip_link = ip;
 		/* We don't want _send_data() to register the tx_handler;
 		 * that neeeds to wait until we're actually connected. */
 		bb->conversation->tx_handler = 0;
--- a/libpurple/protocols/bonjour/jabber.h	Tue May 03 16:12:36 2011 +0000
+++ b/libpurple/protocols/bonjour/jabber.h	Tue May 03 16:37:16 2011 +0000
@@ -63,6 +63,8 @@
 	/* The following are only needed before attaching to a PurpleBuddy */
 	gchar *buddy_name;
 	gchar *ip;
+	/* This points to a data entry in BonjourBuddy->ips */
+	const gchar *ip_link;
 } BonjourJabberConversation;
 
 /**