pidgin.vv: e01cd621: Make RawUdp candidates know if they have...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Thu Mar 19 04:10:30 EDT 2009


-----------------------------------------------------------------
Revision: e01cd621c2fe3248432617254263bbf6911b227e
Ancestor: b49f5cf3e4cbddaefbdc8ad035d49a067443f872
Author: maiku at soc.pidgin.im
Date: 2009-03-19T08:05:49
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/e01cd621c2fe3248432617254263bbf6911b227e

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

ChangeLog: 

Make RawUdp candidates know if they have been sent to the remote client.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/rawudp.c	a397a9186db02074755bb2ff2a7cb63df5ec0a71
+++ libpurple/protocols/jabber/jingle/rawudp.c	55102047468aaaa2a2e082a90376364e31875db2
@@ -59,6 +59,8 @@ jingle_rawudp_candidate_copy(JingleRawUd
 	new_candidate->id = g_strdup(candidate->id);
 	new_candidate->ip = g_strdup(candidate->ip);
 	new_candidate->port = candidate->port;
+
+	new_candidate->rem_known = candidate->rem_known;
 	return new_candidate;
 }
 
@@ -91,6 +93,8 @@ jingle_rawudp_candidate_new(const gchar 
 	candidate->id = g_strdup(id);
 	candidate->ip = g_strdup(ip);
 	candidate->port = port;
+
+	candidate->rem_known = FALSE;
 	return candidate;
 }
 
@@ -280,6 +284,7 @@ jingle_rawudp_parse_internal(xmlnode *ra
 				atoi(xmlnode_get_attrib(candidate, "component")),
 				xmlnode_get_attrib(candidate, "ip"),
 				atoi(xmlnode_get_attrib(candidate, "port")));
+		rawudp_candidate->rem_known = TRUE;
 		jingle_rawudp_add_remote_candidate(JINGLE_RAWUDP(transport), rawudp_candidate);
 	}
 
@@ -289,6 +294,7 @@ jingle_rawudp_parse_internal(xmlnode *ra
 		rawudp_candidate = g_boxed_copy(JINGLE_TYPE_RAWUDP_CANDIDATE, rawudp_candidate);
 		rawudp_candidate->component = 2;
 		rawudp_candidate->port = rawudp_candidate->port + 1;
+		rawudp_candidate->rem_known = TRUE;
 		jingle_rawudp_add_remote_candidate(JINGLE_RAWUDP(transport), rawudp_candidate);
 	}
 
@@ -308,12 +314,18 @@ jingle_rawudp_to_xml_internal(JingleTran
 
 		for (; iter; iter = g_list_next(iter)) {
 			JingleRawUdpCandidate *candidate = iter->data;
+			xmlnode *xmltransport;
+			gchar *generation, *component, *port;
 
-			xmlnode *xmltransport = xmlnode_new_child(node, "candidate");
-			gchar *generation = g_strdup_printf("%d", candidate->generation);
-			gchar *component = g_strdup_printf("%d", candidate->component);
-			gchar *port = g_strdup_printf("%d", candidate->port);
+			if (candidate->rem_known == TRUE)
+				continue;
+			candidate->rem_known = TRUE;
 
+			xmltransport = xmlnode_new_child(node, "candidate");
+			generation = g_strdup_printf("%d", candidate->generation);
+			component = g_strdup_printf("%d", candidate->component);
+			port = g_strdup_printf("%d", candidate->port);
+
 			xmlnode_set_attrib(xmltransport, "generation", generation);
 			xmlnode_set_attrib(xmltransport, "component", component);
 			xmlnode_set_attrib(xmltransport, "id", candidate->id);


More information about the Commits mailing list