cpw.malu.xmpp.jingle_ft: 67c8feba: Generate streamhost candidates for all l...

malu at pidgin.im malu at pidgin.im
Thu Feb 18 18:05:29 EST 2010


-----------------------------------------------------------------
Revision: 67c8febab3659996ecfd7ea1f44e1f99b0543e32
Ancestor: b48283c1085c44f106672a69ffb923f4c34fed81
Author: malu at pidgin.im
Date: 2010-02-18T23:00:50
Branch: im.pidgin.cpw.malu.xmpp.jingle_ft
URL: http://d.pidgin.im/viewmtn/revision/info/67c8febab3659996ecfd7ea1f44e1f99b0543e32

Modified files:
        libpurple/protocols/jabber/jingle/s5b.c

ChangeLog: 

Generate streamhost candidates for all local addresses

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/s5b.c	61d4ceb11ce3081791da9b29a896d6aa3f57050e
+++ libpurple/protocols/jabber/jingle/s5b.c	25e9bf1a34b561d7cb86d56162710532d5676d04
@@ -989,25 +989,31 @@ jingle_s5b_listen_cb(int sock, gpointer 
 
 	if (sock > 0) {
 		guint local_port = purple_network_get_port_from_fd(sock);
-		const gchar *local_ip = purple_network_get_local_system_ip(js->fd);
+		GList *local_ips = purple_network_get_all_local_system_ips();
 		const gchar *public_ip = purple_network_get_my_ip(js->fd);
 		gchar *jid = g_strdup_printf("%s@%s/%s", js->user->node,
 			js->user->domain, js->user->resource);
+		gboolean has_public_ip = FALSE;
 
 		purple_debug_info("jingle-s5b", "successfully open port %d locally\n",
 			local_port);
 
-		if (!purple_strequal(local_ip, "0.0.0.0")) {
+		/* include address(es) of local interface(s) */
+		while (local_ips) {
+			gchar *local_ip = local_ips->data;
 			JingleS5BCandidate *cand =
 				jingle_s5b_candidate_create(js, jid, local_ip, local_port,
 					JINGLE_S5B_CANDIDATE_TYPE_DIRECT);
 			JINGLE_S5B_GET_PRIVATE(s5b)->local_candidates =
 				g_list_append(JINGLE_S5B_GET_PRIVATE(s5b)->local_candidates,
 					cand);
+			if (purple_strequal(local_ip, public_ip))
+				has_public_ip = TRUE;
+			local_ips = g_list_delete_link(local_ips, local_ips);
 		}
 
-		if (!purple_strequal(local_ip, public_ip) && 
-			!purple_strequal(public_ip, "0.0.0.0")) {
+		/* include public IP, assuming there is a port-mapping */
+		if (!has_public_ip && !purple_strequal(public_ip, "0.0.0.0")) {
 			JingleS5BCandidate *cand =
 				jingle_s5b_candidate_create(js, jid, public_ip, local_port,
 					JINGLE_S5B_CANDIDATE_TYPE_ASSISTED);


More information about the Commits mailing list