summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabrice Bellet <fabrice@bellet.info>2016-02-01 11:10:21 +0100
committerFabrice Bellet <fabrice@bellet.info>2017-06-12 17:55:45 +0200
commit3a58ba6120b188d78c5709e0349c0346bfa21c1a (patch)
treeb9c37392f38d6e43485d44a103035970a4ae0bcb
parent7a2c1edf502849a868b6f1026e8e2c343dee4ded (diff)
downloadlibnice-3a58ba6120b188d78c5709e0349c0346bfa21c1a.tar.gz
conncheck: peer reflexive candidates are not paired
This patch makes the code compliant with ICE RFC, 7.2.1.3 "Learning Peer Reflexive Candidates" and 7.1.3.2.1 "Discovering Peer Reflexive Candidates", where discovered candidates do not cause the creation of new pairs to be checked. Differential Revision: https://phabricator.freedesktop.org/D805
-rw-r--r--agent/conncheck.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/agent/conncheck.c b/agent/conncheck.c
index 8c55269..cdf1025 100644
--- a/agent/conncheck.c
+++ b/agent/conncheck.c
@@ -1787,6 +1787,15 @@ int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, NiceCompone
g_assert (remote != NULL);
+ /* note: according to 7.2.1.3, "Learning Peer Reflexive Candidates",
+ * the agent does not pair this candidate with any local candidates.
+ */
+ if (agent->compatibility == NICE_COMPATIBILITY_RFC5245 &&
+ remote->type == NICE_CANDIDATE_TYPE_PEER_REFLEXIVE)
+ {
+ return added;
+ }
+
for (i = component->local_candidates; i ; i = i->next) {
NiceCandidate *local = i->data;
@@ -1821,6 +1830,18 @@ int conn_check_add_for_local_candidate (NiceAgent *agent, guint stream_id, NiceC
g_assert (local != NULL);
+ /*
+ * note: according to 7.1.3.2.1 "Discovering Peer Reflexive
+ * Candidates", the peer reflexive candidate is not paired
+ * with other remote candidates
+ */
+
+ if (agent->compatibility == NICE_COMPATIBILITY_RFC5245 &&
+ local->type == NICE_CANDIDATE_TYPE_PEER_REFLEXIVE)
+ {
+ return added;
+ }
+
for (i = component->remote_candidates; i ; i = i->next) {
NiceCandidate *remote = i->data;