[telepathy-gabble/master] Only group ICE candidates with the same ufrag

Will Thompson will.thompson at collabora.co.uk
Sat Jun 27 08:09:30 PDT 2009


---
 src/jingle-transport-iceudp.c |   40 ++++++++++++++++++++++++++--------------
 1 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/src/jingle-transport-iceudp.c b/src/jingle-transport-iceudp.c
index d7ce043..f40eda5 100644
--- a/src/jingle-transport-iceudp.c
+++ b/src/jingle-transport-iceudp.c
@@ -364,6 +364,7 @@ inject_candidates (GabbleJingleTransportIface *obj,
 {
   GabbleJingleTransportIceUdp *self = GABBLE_JINGLE_TRANSPORT_ICEUDP (obj);
   GabbleJingleTransportIceUdpPrivate *priv = self->priv;
+  const gchar *username = NULL;
 
   for (; priv->pending_candidates != NULL;
       priv->pending_candidates = priv->pending_candidates->next)
@@ -373,6 +374,17 @@ inject_candidates (GabbleJingleTransportIface *obj,
           *type_str, *proto_str;
       LmMessageNode *cnode;
 
+      if (username == NULL)
+        {
+          username = c->username;
+        }
+      else if (tp_strdiff (username, c->username))
+        {
+          DEBUG ("found a candidate with a different username (%s not %s); "
+              "will send in a separate batch", c->username, username);
+          break;
+        }
+
       /* FIXME: We're probably horribly wrong about our usage of
        * priority wrt ICE-UDP draft. Seems to work, though, probably
        * everyone ignores it at the moment. */
@@ -434,25 +446,25 @@ send_candidates (GabbleJingleTransportIface *iface,
 {
   GabbleJingleTransportIceUdp *self = GABBLE_JINGLE_TRANSPORT_ICEUDP (iface);
   GabbleJingleTransportIceUdpPrivate *priv = self->priv;
-  LmMessageNode *trans_node, *sess_node;
-  LmMessage *msg;
 
-  if (priv->pending_candidates == NULL)
+  while (priv->pending_candidates != NULL)
     {
-      DEBUG ("no outstanding candidates to send");
-      return;
-    }
+      LmMessageNode *trans_node, *sess_node;
+      LmMessage *msg;
 
-  msg = gabble_jingle_session_new_message (priv->content->session,
-    JINGLE_ACTION_TRANSPORT_INFO, &sess_node);
+      msg = gabble_jingle_session_new_message (priv->content->session,
+          JINGLE_ACTION_TRANSPORT_INFO, &sess_node);
 
-  gabble_jingle_content_produce_node (priv->content, sess_node, FALSE, TRUE,
-      &trans_node);
-  inject_candidates (iface, trans_node);
+      gabble_jingle_content_produce_node (priv->content, sess_node, FALSE,
+          TRUE, &trans_node);
+      inject_candidates (iface, trans_node);
+
+      _gabble_connection_send_with_reply (priv->content->conn, msg, NULL, NULL,
+          NULL, NULL);
+      lm_message_unref (msg);
+    }
 
-  _gabble_connection_send_with_reply (priv->content->conn, msg, NULL, NULL,
-      NULL, NULL);
-  lm_message_unref (msg);
+  DEBUG ("sent all pending candidates");
 }
 
 /* Takes in a list of slice-allocated JingleCandidate structs */
-- 
1.5.6.5




More information about the telepathy-commits mailing list