Commit 9103a5f2 authored by Fabrice Bellet's avatar Fabrice Bellet Committed by Olivier Crête
Browse files

conncheck: use the right pair when retriggering a check

This patch completes the previous patch by adding a link back from the
discovered pair, to the parent pair that generated this check. This link
is needed by the ICE spec, to comply with section, "Regular
nomination", where the check to be retriggered is the initial check that
caused the discovery of the valid pair. When the valid pair is a
peer-reflexive pair, the retriggered check must target the succeeded
pair, and not the valid discovered pair.

Differential Revision:
parent 72ee528f
......@@ -847,6 +847,16 @@ priv_conn_check_tick_stream_nominate (NiceStream *stream, NiceAgent *agent)
!p->nominated &&
!p->use_candidate_on_next_check &&
p->valid) {
/* According a ICE spec, sect "Regular
* Nomination", we enqueue the check that produced this
* valid pair. When this pair has been discovered, we want
* to test its parent pair instead.
if (p->succeeded_pair != NULL) {
g_assert (p->state == NICE_CHECK_DISCOVERED);
p = p->succeeded_pair;
g_assert (p->state == NICE_CHECK_SUCCEEDED);
nice_debug ("Agent %p : restarting check %p with "
"USE-CANDIDATE attrib (regular nomination)", agent, p);
p->recheck_on_timeout = FALSE;
......@@ -2754,6 +2764,11 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, NiceStream *str
* tcp-active we don't want to retrigger a check on a pair that
* was FAILED when a peer-reflexive pair was created */
if (p->succeeded_pair != NULL) {
g_assert (p->state == NICE_CHECK_DISCOVERED);
p = p->succeeded_pair;
nice_debug ("Agent %p : Found a matching pair %p for triggered check.", agent, p);
if (p->state == NICE_CHECK_WAITING ||
......@@ -2775,8 +2790,7 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, NiceStream *str
p->recheck_on_timeout = TRUE;
else if (p->state == NICE_CHECK_SUCCEEDED ||
else if (p->state == NICE_CHECK_SUCCEEDED) {
nice_debug ("Agent %p : Skipping triggered check, already completed..", agent);
/* note: this is a bit unsure corner-case -- let's do the
same state update as for processing responses to our own checks */
......@@ -2943,6 +2957,7 @@ static CandidateCheckPair *priv_add_peer_reflexive_pair (NiceAgent *agent, guint
pair->sockptr = local_cand->sockptr;
parent_pair->discovered_pair = pair;
pair->succeeded_pair = parent_pair;
nice_debug ("Agent %p : new pair %p state DISCOVERED", agent, pair);
gchar tmpbuf1[INET6_ADDRSTRLEN];
......@@ -4163,7 +4178,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, NiceStream *stream,
pair = priv_conn_check_add_for_candidate_pair_matched (agent,
stream->id, component, local_candidate, remote_candidate,
if (pair) {
pair->valid = TRUE;
......@@ -90,6 +90,7 @@ struct _CandidateCheckPair
gboolean mark_nominated_on_response_arrival;
gboolean recheck_on_timeout;
struct _CandidateCheckPair *discovered_pair;
struct _CandidateCheckPair *succeeded_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