From a2fb11fc34a1cf34fad7f8def5977828ee2bc27e Mon Sep 17 00:00:00 2001 From: Fabrice Bellet Date: Mon, 20 Apr 2020 23:29:49 +0200 Subject: [PATCH] conncheck: simplify the test to find a matching local candidate Since we keep a relation between a succeeded and its discovered pair, we can just test for the socket associated to a given pair, and eventually follow the link to the parent succeeded pair. --- agent/conncheck.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/agent/conncheck.c b/agent/conncheck.c index 7ba378b..67d4f5b 100644 --- a/agent/conncheck.c +++ b/agent/conncheck.c @@ -3203,13 +3203,9 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, NiceStream *str p = i->data; if (p->component_id == component->id && p->remote == remote_cand && - ((p->local->transport == NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE && - p->sockptr == local_socket) || - (p->local->transport != NICE_CANDIDATE_TRANSPORT_TCP_PASSIVE && - p->local->sockptr == local_socket))) { - /* We don't check for p->sockptr because in the case of - * tcp-active we don't want to retrigger a check on a pair that - * was FAILED when a peer-reflexive pair was created */ + p->sockptr == local_socket) { + /* If we match with a peer-reflexive discovered pair, we + * use the parent succeeded pair instead */ if (p->succeeded_pair != NULL) { g_assert_cmpint (p->state, ==, NICE_CHECK_DISCOVERED); -- 2.7.4