changeset 26377:5631378c68c8

Make RawUdp candidates know if they have been sent to the remote client.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Thu, 19 Mar 2009 08:05:49 +0000
parents 1ac93927e7f5
children 55c77c8e75cf
files libpurple/protocols/jabber/jingle/rawudp.c
diffstat 1 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jingle/rawudp.c	Thu Mar 19 07:38:24 2009 +0000
+++ b/libpurple/protocols/jabber/jingle/rawudp.c	Thu Mar 19 08:05:49 2009 +0000
@@ -59,6 +59,8 @@
 	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 @@
 	candidate->id = g_strdup(id);
 	candidate->ip = g_strdup(ip);
 	candidate->port = port;
+
+	candidate->rem_known = FALSE;
 	return candidate;
 }
 
@@ -280,6 +284,7 @@
 				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 @@
 		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,11 +314,17 @@
 
 		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);