pidgin: 15d262d2: bonjour: Update to 427f3622bbeb4 to matc...

datallah at pidgin.im datallah at pidgin.im
Tue May 3 12:41:42 EDT 2011


----------------------------------------------------------------------
Revision: 15d262d25f6f81c8bf68b2de436e86b672f8d980
Parent:   427f3622bbeb4d441ed1d9578800c1d8dce7849f
Author:   datallah at pidgin.im
Date:     05/03/11 12:37:16
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/15d262d25f6f81c8bf68b2de436e86b672f8d980

Changelog: 

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

Changes against parent 427f3622bbeb4d441ed1d9578800c1d8dce7849f

  patched  libpurple/protocols/bonjour/jabber.c
  patched  libpurple/protocols/bonjour/jabber.h

-------------- next part --------------
============================================================
--- libpurple/protocols/bonjour/jabber.c	644bea285388702ee3242a35210c2362c3782c9c
+++ libpurple/protocols/bonjour/jabber.c	32bccc4ccc1b1d62971ce596dad35325bde4f513
@@ -836,8 +836,14 @@ _connected_to_buddy(gpointer data, gint 
 		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 @@ _connected_to_buddy(gpointer data, gint 
 			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 @@ _find_or_start_conversation(BonjourJabbe
 
 		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;
============================================================
--- libpurple/protocols/bonjour/jabber.h	74658715d14a243e6b806b5ed8bc55797ef0d902
+++ libpurple/protocols/bonjour/jabber.h	c2277098331059135ab10da92ebe8c3d9ff4f75e
@@ -63,6 +63,8 @@ typedef struct _BonjourJabberConversatio
 	/* 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;
 
 /**


More information about the Commits mailing list