diff --git a/agent/agent.c b/agent/agent.c index 2fe07a118d266ce78d045fce9b0119a7765b3180..d7ba01986316775e443f45219e0d6f333382ce6a 100644 --- a/agent/agent.c +++ b/agent/agent.c @@ -3616,6 +3616,7 @@ _set_remote_candidates_locked (NiceAgent *agent, NiceStream *stream, } if (added > 0) { + conn_check_remote_candidates_set(agent, stream, component); conn_check_schedule_next (agent); } diff --git a/agent/conncheck.c b/agent/conncheck.c index c76ade1a5d35896cb9c3cabc30d3fa234821c6cc..50d79842ecddf283dd43b7a87773716b811553f7 100644 --- a/agent/conncheck.c +++ b/agent/conncheck.c @@ -1630,56 +1630,64 @@ gint conn_check_compare (const CandidateCheckPair *a, const CandidateCheckPair * return 0; } +void +conn_check_remote_candidates_set(NiceAgent *agent, NiceStream *stream, + NiceComponent *component) +{ + GSList *l, *m; + GList *k; + + for (k = component->incoming_checks.head; k;) { + IncomingCheck *icheck = k->data; + GList *k_next = k->next; + + /* sect 7.2.1.3., "Learning Peer Reflexive Candidates", has to + * be handled separately */ + for (l = component->remote_candidates; l; l = l->next) { + NiceCandidate *rcand = l->data; + NiceCandidate *lcand = NULL; + + if (nice_address_equal (&rcand->addr, &icheck->from)) { + for (m = component->local_candidates; m; m = m->next) { + NiceCandidate *cand = m->data; + + if (nice_address_equal (&cand->addr, &icheck->local_socket->addr)) { + lcand = cand; + break; + } + } + + g_assert (lcand != NULL); + priv_schedule_triggered_check (agent, stream, component, + icheck->local_socket, rcand); + if (icheck->use_candidate) + priv_mark_pair_nominated (agent, stream, component, + lcand, rcand); + + g_queue_delete_link (&component->incoming_checks, k); + break; + } + } + k = k_next; + } +} + /* * Handle any processing steps for connectivity checks after * remote credentials have been set. This function handles * the special case where answerer has sent us connectivity * checks before the answer (containing credentials information), - * reaches us. The special case is documented in sect 7.2 - * if ICE spec (ID-19). + * reaches us. The special case is documented in RFC 5245 sect 7.2. + * ). */ void conn_check_remote_credentials_set(NiceAgent *agent, NiceStream *stream) { - GSList *j, *l, *m; - GList *k; - IncomingCheck *c; + GSList *j; for (j = stream->components; j ; j = j->next) { NiceComponent *component = j->data; - for (k = component->incoming_checks.head; k;) { - IncomingCheck *icheck = k->data; - GList *k_next = k->next; - - /* sect 7.2.1.3., "Learning Peer Reflexive Candidates", has to - * be handled separately */ - for (l = component->remote_candidates; l; l = l->next) { - NiceCandidate *rcand = l->data; - NiceCandidate *lcand = NULL; - - if (nice_address_equal (&rcand->addr, &icheck->from)) { - for (m = component->local_candidates; m; m = m->next) { - NiceCandidate *cand = m->data; - - if (nice_address_equal (&cand->addr, &icheck->local_socket->addr)) { - lcand = cand; - break; - } - } - - g_assert (lcand != NULL); - priv_schedule_triggered_check (agent, stream, component, - icheck->local_socket, rcand); - if (icheck->use_candidate) - priv_mark_pair_nominated (agent, stream, component, - lcand, rcand); - - g_queue_delete_link (&component->incoming_checks, k); - break; - } - } - k = k_next; - } + conn_check_remote_candidates_set(agent, stream, component); } } diff --git a/agent/conncheck.h b/agent/conncheck.h index d162d33971411b8d712e8714bf46afdb1d4898c7..70ea1414b6919cca3632ac1f4d2a75f1358bc965 100644 --- a/agent/conncheck.h +++ b/agent/conncheck.h @@ -111,6 +111,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