101 lines
5.6 KiB
Diff
101 lines
5.6 KiB
Diff
From 7bbcde51e11f44f69bc5b5f1eede93a9d11e11f8 Mon Sep 17 00:00:00 2001
|
|
From: Philip Withnall <philip@tecnocode.co.uk>
|
|
Date: Tue, 1 Mar 2016 22:33:51 +0000
|
|
Subject: [PATCH] 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: Philip Withnall <philip@tecnocode.co.uk>
|
|
Differential Revision: https://phabricator.freedesktop.org/D808
|
|
(cherry picked from commit c309905ff446bed2dc47811023b98bc586a02d63)
|
|
---
|
|
agent/conncheck.c | 21 +++++++++------------
|
|
1 file changed, 9 insertions(+), 12 deletions(-)
|
|
|
|
diff --git a/agent/conncheck.c b/agent/conncheck.c
|
|
index 057fc81..62be0c4 100644
|
|
--- a/agent/conncheck.c
|
|
+++ b/agent/conncheck.c
|
|
@@ -65,7 +65,7 @@ static void priv_update_check_list_failed_components (NiceAgent *agent, Stream *
|
|
static void priv_update_check_list_state_for_ready (NiceAgent *agent, Stream *stream, Component *component);
|
|
static guint priv_prune_pending_checks (Stream *stream, guint component_id);
|
|
static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream, Component *component, NiceSocket *local_socket, NiceCandidate *remote_cand, gboolean use_candidate);
|
|
-static void priv_mark_pair_nominated (NiceAgent *agent, Stream *stream, Component *component, NiceCandidate *remotecand);
|
|
+static void priv_mark_pair_nominated (NiceAgent *agent, Stream *stream, Component *component, NiceCandidate *localcand, NiceCandidate *remotecand);
|
|
static size_t priv_create_username (NiceAgent *agent, Stream *stream,
|
|
guint component_id, NiceCandidate *remote, NiceCandidate *local,
|
|
uint8_t *dest, guint dest_len, gboolean inbound);
|
|
@@ -1004,7 +1004,7 @@ static void priv_preprocess_conn_check_pending_data (NiceAgent *agent, Stream *s
|
|
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);
|
|
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);
|
|
}
|
|
}
|
|
@@ -1148,7 +1148,7 @@ void conn_check_remote_candidates_set(NiceAgent *agent)
|
|
conn_check_add_for_candidate (agent, stream->id, component, 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);
|
|
}
|
|
}
|
|
@@ -1337,7 +1337,7 @@ static void priv_update_check_list_state_for_ready (NiceAgent *agent, Stream *st
|
|
* described by 'component' and 'remotecand' is nominated
|
|
* for use.
|
|
*/
|
|
-static void priv_mark_pair_nominated (NiceAgent *agent, Stream *stream, Component *component, NiceCandidate *remotecand)
|
|
+static void priv_mark_pair_nominated (NiceAgent *agent, Stream *stream, Component *component, NiceCandidate *localcand, NiceCandidate *remotecand)
|
|
{
|
|
GSList *i;
|
|
|
|
@@ -1346,10 +1346,7 @@ static void priv_mark_pair_nominated (NiceAgent *agent, Stream *stream, Componen
|
|
/* step: search for at least one nominated pair */
|
|
for (i = stream->conncheck_list; i; i = i->next) {
|
|
CandidateCheckPair *pair = i->data;
|
|
- /* XXX: hmm, how to figure out to which local candidate the
|
|
- * check was sent to? let's mark all matching pairs
|
|
- * as nominated instead */
|
|
- if (pair->remote == remotecand) {
|
|
+ if (pair->local == localcand && pair->remote == remotecand) {
|
|
nice_debug ("Agent %p : marking pair %p (%s) as nominated", agent, pair, pair->foundation);
|
|
pair->nominated = TRUE;
|
|
if (pair->state == NICE_CHECK_SUCCEEDED ||
|
|
@@ -2121,7 +2118,7 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream,
|
|
*
|
|
* @pre (rcand == NULL || nice_address_equal(rcand->addr, toaddr) == TRUE)
|
|
*/
|
|
-static void priv_reply_to_conn_check (NiceAgent *agent, Stream *stream, Component *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, Stream *stream, Component *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);
|
|
|
|
@@ -2144,7 +2141,7 @@ static void priv_reply_to_conn_check (NiceAgent *agent, Stream *stream, Componen
|
|
priv_schedule_triggered_check (agent, stream, component, sockptr, rcand, use_candidate);
|
|
|
|
if (use_candidate)
|
|
- priv_mark_pair_nominated (agent, stream, component, rcand);
|
|
+ priv_mark_pair_nominated (agent, stream, component, lcand, rcand);
|
|
}
|
|
}
|
|
|
|
@@ -3302,8 +3299,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
|
|
}
|
|
}
|
|
|
|
- priv_reply_to_conn_check (agent, stream, component, remote_candidate,
|
|
- from, nicesock, rbuf_len, rbuf, use_candidate);
|
|
+ priv_reply_to_conn_check (agent, stream, component, local_candidate,
|
|
+ remote_candidate, from, nicesock, rbuf_len, rbuf, use_candidate);
|
|
|
|
if (component->remote_candidates == NULL) {
|
|
/* case: We've got a valid binding request to a local candidate
|
|
--
|
|
2.7.4
|
|
|