Commit 72ee528f authored by Fabrice Bellet's avatar Fabrice Bellet Committed by Olivier Crête

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 2fd78084
......@@ -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];
......
......@@ -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 */
......
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