summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabrice Bellet <fabrice@bellet.info>2016-03-07 16:35:09 +0100
committerFabrice Bellet <fabrice@bellet.info>2017-06-12 17:55:45 +0200
commit58d061df8f5425dc1add9c6030a2f891ebda4616 (patch)
treee5ac0937a75367dd50d03bdfbda11669bf13f566
parent4497d9b7afaaea7124db4a2cd13546d9366b5986 (diff)
downloadlibnice-58d061df8f5425dc1add9c6030a2f891ebda4616.tar.gz
conncheck: update pair valid property selectively
With this patch, we fix a corner case when the succeeded pair is a peer-reflexive candidate pair, that already has been discovered previously, In this case, the current pair -p- should not be marked valid, because the valid flag is already set on the discovered pair. Differential Revision: https://phabricator.freedesktop.org/D1124
-rw-r--r--agent/conncheck.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/agent/conncheck.c b/agent/conncheck.c
index 6827e6e..ef8df68 100644
--- a/agent/conncheck.c
+++ b/agent/conncheck.c
@@ -2760,6 +2760,13 @@ static CandidateCheckPair *priv_process_response_check_for_reflexive(NiceAgent *
}
if (new_pair) {
+ /* note: when new_pair is distinct from p, it means new_pair is a
+ * previously discovered peer-reflexive candidate pair, so we don't
+ * set the valid flag on p in this case, because the valid flag is
+ * already set on the discovered pair.
+ */
+ if (new_pair == p)
+ p->valid = TRUE;
p->state = NICE_CHECK_SUCCEEDED;
nice_debug ("Agent %p : conncheck %p SUCCEEDED.", agent, p);
priv_conn_check_unfreeze_related (agent, stream, p);
@@ -2788,6 +2795,10 @@ static CandidateCheckPair *priv_process_response_check_for_reflexive(NiceAgent *
if (local_cand)
new_pair = priv_add_peer_reflexive_pair (agent, stream->id, component,
local_cand, p);
+ /* note: this is same as "adding to VALID LIST" in the spec
+ text */
+ if (new_pair)
+ new_pair->valid = TRUE;
/* step: The agent sets the state of the pair that *generated* the check to
* Succeeded, RFC 5245, 7.1.3.2.3, "Updating Pair States"
*/
@@ -2796,12 +2807,9 @@ static CandidateCheckPair *priv_process_response_check_for_reflexive(NiceAgent *
agent, p, new_pair);
}
- /* note: this is same as "adding to VALID LIST" in the spec
- text */
- if (new_pair) {
- new_pair->valid = TRUE;
+ if (new_pair && new_pair->valid)
nice_component_add_valid_candidate (component, remote_candidate);
- }
+
return new_pair;
}