tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit 5d63842e86d60e2efdede4dd7afe25666eb86b9d
parent dbd37c0e7bb872208d4282d58f5b66d2fced781f
Author: Mike Perry <mikeperry-git@torproject.org>
Date:   Tue, 13 Jun 2023 18:15:07 +0000

Bug 40810: Avoid using 0 RTT legs

Diffstat:
Msrc/core/or/conflux.c | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/core/or/conflux.c b/src/core/or/conflux.c @@ -244,7 +244,9 @@ conflux_decide_circ_minrtt(const conflux_t *cfx) tor_assert(CONFLUX_NUM_LEGS(cfx)); CONFLUX_FOR_EACH_LEG_BEGIN(cfx, leg) { - if (leg->circ_rtts_usec < min_rtt) { + + /* Ignore circuits with no RTT measurement */ + if (leg->circ_rtts_usec && leg->circ_rtts_usec < min_rtt) { circ = leg->circ; min_rtt = leg->circ_rtts_usec; } @@ -279,7 +281,8 @@ conflux_decide_circ_lowrtt(const conflux_t *cfx) continue; } - if (leg->circ_rtts_usec < low_rtt) { + /* Ignore circuits with no RTT */ + if (leg->circ_rtts_usec && leg->circ_rtts_usec < low_rtt) { low_rtt = leg->circ_rtts_usec; circ = leg->circ; } @@ -399,7 +402,8 @@ conflux_decide_circ_cwndrtt(const conflux_t *cfx) /* Find the leg with the minimum RTT.*/ CONFLUX_FOR_EACH_LEG_BEGIN(cfx, l) { - if (l->circ_rtts_usec < min_rtt) { + /* Ignore circuits with invalid RTT */ + if (l->circ_rtts_usec && l->circ_rtts_usec < min_rtt) { min_rtt = l->circ_rtts_usec; leg = l; } @@ -420,7 +424,8 @@ conflux_decide_circ_cwndrtt(const conflux_t *cfx) /* Pick a 'min_leg' with the lowest RTT that still has * room in the congestion window. Note that this works for * min_leg itself, up to inflight. */ - if (cwnd_sendable(l->circ, min_rtt, l->circ_rtts_usec) > 0) { + if (l->circ_rtts_usec && + cwnd_sendable(l->circ, min_rtt, l->circ_rtts_usec) > 0) { leg = l; } } CONFLUX_FOR_EACH_LEG_END(l);