From 6dd3969404da66ee347313b7c9bd648579e7b9bb Mon Sep 17 00:00:00 2001 From: Fabrice Bellet Date: Thu, 9 Apr 2020 16:47:17 +0200 Subject: [PATCH] conncheck: add missing cases when pruning pending checks When pruning pending checks (after at least one nominated pair has been obtained), some supplementary cases need to be handled, to ensure that the property "all pairs and only the pairs having a higher priority than the nominated pair should have the stun retransmit flag set" remains true during the whole conncheck: - a pair "not to be retransmitted" must be removed from the triggered check list (because a triggered check would create a new stun request, that would defacto ignore the retransmit flag) - an in-progress pair "not to be retransmitted", for which no stun request has been sent (p->stun_transactions == NULL, a transient state) must be removed from the conncheck list, just like a waiting pair. - a failed pair must have its flag "retransmit" updated too, just like another pair, since a failed pair could match an inbound check, and generate a triggered check, based on retransmit flag value : ie only if this pair has a chance to become a better nominated pair. See NICE_CHECK_FAILED case in priv_schedule_triggered_check(). --- agent/conncheck.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/agent/conncheck.c b/agent/conncheck.c index abaf5f2..41d8c92 100644 --- a/agent/conncheck.c +++ b/agent/conncheck.c @@ -3140,10 +3140,17 @@ static guint priv_prune_pending_checks (NiceAgent *agent, NiceStream *stream, Ni /* note: a SHOULD level req. in ICE 8.1.2. "Updating States" (ID-19) */ else if (p->state == NICE_CHECK_IN_PROGRESS) { if (p->priority < priority) { + priv_remove_pair_from_triggered_check_queue (agent, p); if (p->retransmit && p->stun_transactions) { p->retransmit = FALSE; nice_debug ("Agent %p : pair %p will not be retransmitted.", agent, p); + } else if (p->retransmit) { + /* Pair in-progress, but stun request not yet sent */ + nice_debug ("Agent %p : pair %p removed.", agent, p); + candidate_check_pair_free (agent, p); + stream->conncheck_list = g_slist_delete_link(stream->conncheck_list, + i); } } else { /* We must keep the higher priority pairs running because if a udp @@ -3161,6 +3168,12 @@ static guint priv_prune_pending_checks (NiceAgent *agent, NiceStream *stream, Ni in_progress++; } } + /* A triggered check on a failed pair will depend on the retransmit + * flag, so on the relative priority of this pair and the nominated + * pair. + */ + else if (p->state == NICE_CHECK_FAILED) + p->retransmit = (p->priority > priority ? TRUE : FALSE); i = next; } -- 2.7.4