From a602ff57aae6a6afdeab843954c48e6fb5d82d31 Mon Sep 17 00:00:00 2001 From: Fabrice Bellet Date: Tue, 12 Apr 2016 13:02:45 +0200 Subject: conncheck: fix pair state transition when successful response is received According the ICE RFC 5245, 7.1.3.2.3, the pair that *generated* a successful check should go to state succeeded, not only the valid pair built in section 7.1.3.2.2. Differential Revision: https://phabricator.freedesktop.org/D810 --- agent/conncheck.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/agent/conncheck.c b/agent/conncheck.c index cdf1025..7fc2a1d 100644 --- a/agent/conncheck.c +++ b/agent/conncheck.c @@ -2654,7 +2654,10 @@ static CandidateCheckPair *priv_process_response_check_for_reflexive(NiceAgent * } else { if (!local_cand) { - if (!agent->force_relay) + if (!agent->force_relay) { + /* step: find a new local candidate, see RFC 5245 7.1.3.2.1. + * "Discovering Peer Reflexive Candidates" + */ local_cand = discovery_add_peer_reflexive_candidate (agent, stream->id, component->id, @@ -2662,8 +2665,9 @@ static CandidateCheckPair *priv_process_response_check_for_reflexive(NiceAgent * sockptr, local_candidate, remote_candidate); - p->state = NICE_CHECK_FAILED; - nice_debug ("Agent %p : pair %p state FAILED", agent, p); + nice_debug ("Agent %p : added a new peer-reflexive local candidate %p", + agent, local_cand); + } } /* step: add a new discovered pair (see RFC 5245 7.1.3.2.2 @@ -2671,7 +2675,12 @@ 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); - nice_debug ("Agent %p : conncheck %p FAILED, %p DISCOVERED.", agent, p, new_pair); + /* 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" + */ + p->state = NICE_CHECK_SUCCEEDED; + nice_debug ("Agent %p : conncheck %p SUCCEEDED, %p DISCOVERED.", + agent, p, new_pair); } /* note: this is same as "adding to VALID LIST" in the spec -- cgit v1.2.1