Commit c309905f authored by Philip Withnall's avatar Philip Withnall

conncheck: nominate only one matching pair

This patch fixes a bug in priv_mark_pair_nominated(), where the local
candidate was not passed to the function, so removing the possibility to
find which local candidate the check was sent to.
Reviewed-by: default avatarPhilip Withnall <philip@tecnocode.co.uk>
Differential Revision: https://phabricator.freedesktop.org/D808
parent 80973c09
...@@ -65,7 +65,7 @@ static void priv_update_check_list_failed_components (NiceAgent *agent, NiceStre ...@@ -65,7 +65,7 @@ static void priv_update_check_list_failed_components (NiceAgent *agent, NiceStre
static void priv_update_check_list_state_for_ready (NiceAgent *agent, NiceStream *stream, NiceComponent *component); static void priv_update_check_list_state_for_ready (NiceAgent *agent, NiceStream *stream, NiceComponent *component);
static guint priv_prune_pending_checks (NiceStream *stream, guint component_id); static guint priv_prune_pending_checks (NiceStream *stream, guint component_id);
static gboolean priv_schedule_triggered_check (NiceAgent *agent, NiceStream *stream, NiceComponent *component, NiceSocket *local_socket, NiceCandidate *remote_cand, gboolean use_candidate); static gboolean priv_schedule_triggered_check (NiceAgent *agent, NiceStream *stream, NiceComponent *component, NiceSocket *local_socket, NiceCandidate *remote_cand, gboolean use_candidate);
static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, NiceComponent *component, NiceCandidate *remotecand); static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, NiceComponent *component, NiceCandidate *localcand, NiceCandidate *remotecand);
static size_t priv_create_username (NiceAgent *agent, NiceStream *stream, static size_t priv_create_username (NiceAgent *agent, NiceStream *stream,
guint component_id, NiceCandidate *remote, NiceCandidate *local, guint component_id, NiceCandidate *remote, NiceCandidate *local,
uint8_t *dest, guint dest_len, gboolean inbound); uint8_t *dest, guint dest_len, gboolean inbound);
...@@ -1012,7 +1012,7 @@ static void priv_preprocess_conn_check_pending_data (NiceAgent *agent, NiceStrea ...@@ -1012,7 +1012,7 @@ static void priv_preprocess_conn_check_pending_data (NiceAgent *agent, NiceStrea
icheck->local_socket == pair->sockptr) { icheck->local_socket == pair->sockptr) {
nice_debug ("Agent %p : Updating check %p with stored early-icheck %p, %p/%u/%u (agent/stream/component).", agent, pair, icheck, agent, stream->id, component->id); nice_debug ("Agent %p : Updating check %p with stored early-icheck %p, %p/%u/%u (agent/stream/component).", agent, pair, icheck, agent, stream->id, component->id);
if (icheck->use_candidate) if (icheck->use_candidate)
priv_mark_pair_nominated (agent, stream, component, pair->remote); priv_mark_pair_nominated (agent, stream, component, pair->local, pair->remote);
priv_schedule_triggered_check (agent, stream, component, icheck->local_socket, pair->remote, icheck->use_candidate); priv_schedule_triggered_check (agent, stream, component, icheck->local_socket, pair->remote, icheck->use_candidate);
} }
} }
...@@ -1156,7 +1156,7 @@ void conn_check_remote_candidates_set(NiceAgent *agent) ...@@ -1156,7 +1156,7 @@ void conn_check_remote_candidates_set(NiceAgent *agent)
conn_check_add_for_candidate (agent, stream->id, component, candidate); conn_check_add_for_candidate (agent, stream->id, component, candidate);
if (icheck->use_candidate) if (icheck->use_candidate)
priv_mark_pair_nominated (agent, stream, component, candidate); priv_mark_pair_nominated (agent, stream, component, local_candidate, candidate);
priv_schedule_triggered_check (agent, stream, component, icheck->local_socket, candidate, icheck->use_candidate); priv_schedule_triggered_check (agent, stream, component, icheck->local_socket, candidate, icheck->use_candidate);
} }
} }
...@@ -1354,7 +1354,7 @@ static void priv_update_check_list_state_for_ready (NiceAgent *agent, NiceStream ...@@ -1354,7 +1354,7 @@ static void priv_update_check_list_state_for_ready (NiceAgent *agent, NiceStream
* described by 'component' and 'remotecand' is nominated * described by 'component' and 'remotecand' is nominated
* for use. * for use.
*/ */
static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, NiceComponent *component, NiceCandidate *remotecand) static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, NiceComponent *component, NiceCandidate *localcand, NiceCandidate *remotecand)
{ {
GSList *i; GSList *i;
...@@ -1363,10 +1363,7 @@ static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, Nice ...@@ -1363,10 +1363,7 @@ static void priv_mark_pair_nominated (NiceAgent *agent, NiceStream *stream, Nice
/* step: search for at least one nominated pair */ /* step: search for at least one nominated pair */
for (i = stream->conncheck_list; i; i = i->next) { for (i = stream->conncheck_list; i; i = i->next) {
CandidateCheckPair *pair = i->data; CandidateCheckPair *pair = i->data;
/* XXX: hmm, how to figure out to which local candidate the if (pair->local == localcand && pair->remote == remotecand) {
* check was sent to? let's mark all matching pairs
* as nominated instead */
if (pair->remote == remotecand) {
nice_debug ("Agent %p : marking pair %p (%s) as nominated", agent, pair, pair->foundation); nice_debug ("Agent %p : marking pair %p (%s) as nominated", agent, pair, pair->foundation);
pair->nominated = TRUE; pair->nominated = TRUE;
if (pair->state == NICE_CHECK_SUCCEEDED || if (pair->state == NICE_CHECK_SUCCEEDED ||
...@@ -2159,7 +2156,7 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, NiceStream *str ...@@ -2159,7 +2156,7 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, NiceStream *str
* *
* @pre (rcand == NULL || nice_address_equal(rcand->addr, toaddr) == TRUE) * @pre (rcand == NULL || nice_address_equal(rcand->addr, toaddr) == TRUE)
*/ */
static void priv_reply_to_conn_check (NiceAgent *agent, NiceStream *stream, NiceComponent *component, NiceCandidate *rcand, const NiceAddress *toaddr, NiceSocket *sockptr, size_t rbuf_len, uint8_t *rbuf, gboolean use_candidate) static void priv_reply_to_conn_check (NiceAgent *agent, NiceStream *stream, NiceComponent *component, NiceCandidate *lcand, NiceCandidate *rcand, const NiceAddress *toaddr, NiceSocket *sockptr, size_t rbuf_len, uint8_t *rbuf, gboolean use_candidate)
{ {
g_assert (rcand == NULL || nice_address_equal(&rcand->addr, toaddr) == TRUE); g_assert (rcand == NULL || nice_address_equal(&rcand->addr, toaddr) == TRUE);
...@@ -2182,7 +2179,7 @@ static void priv_reply_to_conn_check (NiceAgent *agent, NiceStream *stream, Nice ...@@ -2182,7 +2179,7 @@ static void priv_reply_to_conn_check (NiceAgent *agent, NiceStream *stream, Nice
priv_schedule_triggered_check (agent, stream, component, sockptr, rcand, use_candidate); priv_schedule_triggered_check (agent, stream, component, sockptr, rcand, use_candidate);
if (use_candidate) if (use_candidate)
priv_mark_pair_nominated (agent, stream, component, rcand); priv_mark_pair_nominated (agent, stream, component, lcand, rcand);
} }
} }
...@@ -3351,8 +3348,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, NiceStream *stream, ...@@ -3351,8 +3348,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, NiceStream *stream,
} }
} }
priv_reply_to_conn_check (agent, stream, component, remote_candidate, priv_reply_to_conn_check (agent, stream, component, local_candidate,
from, nicesock, rbuf_len, rbuf, use_candidate); remote_candidate, from, nicesock, rbuf_len, rbuf, use_candidate);
if (component->remote_candidates == NULL) { if (component->remote_candidates == NULL) {
/* case: We've got a valid binding request to a local candidate /* case: We've got a valid binding request to a local candidate
......
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