diff options
author | Fabrice Bellet <fabrice@bellet.info> | 2016-04-12 13:02:45 +0200 |
---|---|---|
committer | Fabrice Bellet <fabrice@bellet.info> | 2017-06-12 17:55:45 +0200 |
commit | a602ff57aae6a6afdeab843954c48e6fb5d82d31 (patch) | |
tree | 4fd299d3c2dff26ce587a5a878610a6a36aa7ea2 | |
parent | 3a58ba6120b188d78c5709e0349c0346bfa21c1a (diff) | |
download | libnice-a602ff57aae6a6afdeab843954c48e6fb5d82d31.tar.gz |
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
-rw-r--r-- | agent/conncheck.c | 17 |
1 files 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 |