Commit 582482df authored by Fabrice Bellet's avatar Fabrice Bellet

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
parent df2f79a2
...@@ -1926,6 +1926,12 @@ static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, Nice ...@@ -1926,6 +1926,12 @@ static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, Nice
* candidate, generating a "discovered" pair that can be * candidate, generating a "discovered" pair that can be
* nominated. * 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) { if (pair->valid) {
nice_debug ("Agent %p : marking pair %p (%s) as nominated", nice_debug ("Agent %p : marking pair %p (%s) as nominated",
agent, pair, pair->foundation); agent, pair, pair->foundation);
...@@ -2934,6 +2940,7 @@ static CandidateCheckPair *priv_add_peer_reflexive_pair (NiceAgent *agent, guint ...@@ -2934,6 +2940,7 @@ static CandidateCheckPair *priv_add_peer_reflexive_pair (NiceAgent *agent, guint
pair->remote = parent_pair->remote; pair->remote = parent_pair->remote;
pair->sockptr = local_cand->sockptr; pair->sockptr = local_cand->sockptr;
pair->state = NICE_CHECK_DISCOVERED; pair->state = NICE_CHECK_DISCOVERED;
parent_pair->discovered_pair = pair;
nice_debug ("Agent %p : new pair %p state DISCOVERED", agent, pair); nice_debug ("Agent %p : new pair %p state DISCOVERED", agent, pair);
{ {
gchar tmpbuf1[INET6_ADDRSTRLEN]; gchar tmpbuf1[INET6_ADDRSTRLEN];
......
...@@ -89,6 +89,7 @@ struct _CandidateCheckPair ...@@ -89,6 +89,7 @@ struct _CandidateCheckPair
gboolean use_candidate_on_next_check; gboolean use_candidate_on_next_check;
gboolean mark_nominated_on_response_arrival; gboolean mark_nominated_on_response_arrival;
gboolean recheck_on_timeout; gboolean recheck_on_timeout;
struct _CandidateCheckPair *discovered_pair;
guint64 priority; guint64 priority;
guint32 prflx_priority; guint32 prflx_priority;
GTimeVal next_tick; /* next tick timestamp */ GTimeVal next_tick; /* next tick timestamp */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment