Commit 59ce41df authored by Miguel París Díaz's avatar Miguel París Díaz Committed by Olivier Crête

conncheck: consider answer received when remote credentials are set

Consider that the answer is received when remote credentials
are set instead of when a remote candidate is set,
which could not happen or could cause more delay for the
connection establishment.

Ported to git master by Olivier Crête

Differential Revision: https://phabricator.freedesktop.org/D1704
parent a4bacb2f
......@@ -3240,6 +3240,8 @@ nice_agent_set_remote_credentials (
g_strlcpy (stream->remote_ufrag, ufrag, NICE_STREAM_MAX_UFRAG);
g_strlcpy (stream->remote_password, pwd, NICE_STREAM_MAX_PWD);
conn_check_remote_credentials_set(agent, stream);
ret = TRUE;
goto done;
}
......@@ -3342,8 +3344,6 @@ _set_remote_candidates_locked (NiceAgent *agent, NiceStream *stream,
}
}
conn_check_remote_candidates_set(agent, stream, component);
if (added > 0) {
conn_check_schedule_next (agent);
}
......
......@@ -1243,19 +1243,20 @@ static GSList *prune_cancelled_conn_check (GSList *conncheck_list)
/*
* Handle any processing steps for connectivity checks after
* remote candidates have been set. This function handles
* remote credentials have been set. This function handles
* the special case where answerer has sent us connectivity
* checks before the answer (containing candidate information),
* checks before the answer (containing credentials information),
* reaches us. The special case is documented in sect 7.2
* if ICE spec (ID-19).
*/
void conn_check_remote_candidates_set(NiceAgent *agent, NiceStream *stream, NiceComponent *component)
void conn_check_remote_credentials_set(NiceAgent *agent, NiceStream *stream)
{
GSList *j, *k, *l, *m, *n;
GSList *j, *k, *l, *m, *n, *o;
for (j = stream->conncheck_list; j ; j = j->next) {
CandidateCheckPair *pair = j->data;
if (pair->component_id == component->id) {
NiceComponent *component =
nice_stream_find_component_by_id (stream, pair->component_id);
gboolean match = FALSE;
/* performn delayed processing of spec steps section 7.2.1.4,
......@@ -1363,14 +1364,16 @@ void conn_check_remote_candidates_set(NiceAgent *agent, NiceStream *stream, Nice
}
}
}
}
/* Once we process the pending checks, we should free them to avoid
* reprocessing them again if a dribble-mode set_remote_candidates
* is called */
for (o = stream->components; o; o = o->next) {
NiceComponent *component = o->data;
g_slist_free_full (component->incoming_checks,
(GDestroyNotify) incoming_check_free);
component->incoming_checks = NULL;
}
stream->conncheck_list =
prune_cancelled_conn_check (stream->conncheck_list);
......@@ -3628,14 +3631,14 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, NiceStream *stream,
if (stream->initial_binding_request_received != TRUE)
agent_signal_initial_binding_request_received (agent, stream);
if (component->remote_candidates && remote_candidate == NULL) {
if (remote_candidate == NULL) {
nice_debug ("Agent %p : No matching remote candidate for incoming check ->"
"peer-reflexive candidate.", agent);
remote_candidate = discovery_learn_remote_peer_reflexive_candidate (
agent, stream, component, priority, from, nicesock,
local_candidate,
remote_candidate2 ? remote_candidate2 : remote_candidate);
if(remote_candidate) {
if(remote_candidate && stream->remote_ufrag != NULL) {
if (local_candidate &&
local_candidate->transport == NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE) {
CandidateCheckPair *pair;
......@@ -3654,10 +3657,10 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, NiceStream *stream,
priv_reply_to_conn_check (agent, stream, component, local_candidate,
remote_candidate, from, nicesock, rbuf_len, &msg, use_candidate);
if (component->remote_candidates == NULL) {
if (stream->remote_ufrag == NULL) {
/* case: We've got a valid binding request to a local candidate
* but we do not yet know remote credentials nor
* candidates. As per sect 7.2 of ICE (ID-19), we send a reply
* but we do not yet know remote credentials.
* As per sect 7.2 of ICE (ID-19), we send a reply
* immediately but postpone all other processing until
* we get information about the remote candidates */
......
......@@ -105,7 +105,7 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair);
void conn_check_prune_stream (NiceAgent *agent, NiceStream *stream);
gboolean conn_check_handle_inbound_stun (NiceAgent *agent, NiceStream *stream, NiceComponent *component, NiceSocket *udp_socket, const NiceAddress *from, gchar *buf, guint len);
gint conn_check_compare (const CandidateCheckPair *a, const CandidateCheckPair *b);
void conn_check_remote_candidates_set(NiceAgent *agent, NiceStream *stream, NiceComponent *component);
void conn_check_remote_credentials_set(NiceAgent *agent, NiceStream *stream);
NiceCandidateTransport conn_check_match_transport (NiceCandidateTransport transport);
void
conn_check_prune_socket (NiceAgent *agent, NiceStream *stream, NiceComponent *component,
......
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