cpw.malu.xmpp.jingle_ft: b464ecdf: Remove port mapping when the remote clie...

malu at pidgin.im malu at pidgin.im
Wed Aug 5 15:11:20 EDT 2009


-----------------------------------------------------------------
Revision: b464ecdf350776f3dadd0ecfdee7425eeea5adce
Ancestor: f96cbc5902e4a7b026a7d8477c272575b1efbf80
Author: malu at pidgin.im
Date: 2009-08-05T19:08:31
Branch: im.pidgin.cpw.malu.xmpp.jingle_ft
URL: http://d.pidgin.im/viewmtn/revision/info/b464ecdf350776f3dadd0ecfdee7425eeea5adce

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

ChangeLog: 

Remove port mapping when the remote client has selected an candidate other than
the assisted one, this way we avoid keeping unneeded UPnP mappings around when
not needed.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/s5b.c	3c0e2d245e750967a89f44ff58a1a72dd45a98e2
+++ libpurple/protocols/jabber/jingle/s5b.c	f430fc08db950e09bb40b48fe55e3714303b5fe1
@@ -335,7 +335,10 @@ jingle_s5b_finalize (GObject *s5b)
 
 	/* remove port mapping */
 	if (priv->fd >= 0) {
-		purple_network_remove_port_mapping(priv->fd);
+		if (priv->accepted_candidate &&
+			priv->accepted_candidate->type == JINGLE_S5B_CANDIDATE_TYPE_ASSISTED) {
+			purple_network_remove_port_mapping(priv->fd);
+		}
 		close(priv->fd);
 	} else if (priv->local_fd >= 0) {
 		purple_network_remove_port_mapping(priv->local_fd);
@@ -576,6 +579,12 @@ jingle_s5b_take_command(JingleS5B *s5b)
 		purple_timeout_remove(s5b->priv->connect_timeout);
 		s5b->priv->connect_timeout = 0;
 	}
+
+	/* remove port mappings for non-assisted candidates */
+	if (s5b->priv->accepted_candidate->type != 
+		JINGLE_S5B_CANDIDATE_TYPE_ASSISTED) {
+		purple_network_remove_port_mapping(s5b->priv->local_fd);
+	}
 }
 
 static gboolean


More information about the Commits mailing list