summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabrice Bellet <fabrice@bellet.info>2016-04-12 13:25:16 +0200
committerOlivier CrĂȘte <olivier.crete@collabora.com>2017-06-21 16:05:56 -0400
commit72ee528f7fdf82fb1a44958c18a0d4d5055d2d1a (patch)
tree423abb11bf3eafde2d7d3790b176267691a20f2f
parent2fd7808419f459d5f6e97701ca6a350ddee6b7f2 (diff)
downloadlibnice-72ee528f7fdf82fb1a44958c18a0d4d5055d2d1a.tar.gz
conncheck: link succeeded and discovered pairs
When the agent has the role of the stun server, is in controlled mode, and receives a pair with the "use-candidate" attribute set, it must find a matching succeded or discovered pair in its conncheck list. This is described in ICE spec 7.2.1.5, "Updating the Nominated Flag", item #1. When a matching pair is in succeeded state, the agent must nominate the valid pair (a discovered pair) constructed from section 7.1.3.2.2, that's been created from this succeeded one. To make this lookup, we introduce a new "discovered_pair" member of the CandidateCheckPair struct, that links the succeeded pair, and its discovered pair if any. Differential Revision: https://phabricator.freedesktop.org/D878
-rw-r--r--agent/conncheck.c7
-rw-r--r--agent/conncheck.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/agent/conncheck.c b/agent/conncheck.c
index 3a489fe..99cb6d2 100644
--- a/agent/conncheck.c
+++ b/agent/conncheck.c
@@ -1928,6 +1928,12 @@ static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, Nice
* candidate, generating a "discovered" pair that can be
* nominated.
*/
+ if (pair->state == NICE_CHECK_SUCCEEDED &&
+ pair->discovered_pair != NULL) {
+ pair = pair->discovered_pair;
+ g_assert (pair->state == NICE_CHECK_DISCOVERED);
+ }
+
if (pair->valid) {
nice_debug ("Agent %p : marking pair %p (%s) as nominated",
agent, pair, pair->foundation);
@@ -2936,6 +2942,7 @@ static CandidateCheckPair *priv_add_peer_reflexive_pair (NiceAgent *agent, guint
pair->remote = parent_pair->remote;
pair->sockptr = local_cand->sockptr;
pair->state = NICE_CHECK_DISCOVERED;
+ parent_pair->discovered_pair = pair;
nice_debug ("Agent %p : new pair %p state DISCOVERED", agent, pair);
{
gchar tmpbuf1[INET6_ADDRSTRLEN];
diff --git a/agent/conncheck.h b/agent/conncheck.h
index 785a6cd..dd47ebe 100644
--- a/agent/conncheck.h
+++ b/agent/conncheck.h
@@ -89,6 +89,7 @@ struct _CandidateCheckPair
gboolean use_candidate_on_next_check;
gboolean mark_nominated_on_response_arrival;
gboolean recheck_on_timeout;
+ struct _CandidateCheckPair *discovered_pair;
guint64 priority;
guint32 prflx_priority;
GTimeVal next_tick; /* next tick timestamp */