summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2023-06-13 18:15:07 +0000
committerMike Perry <mikeperry-git@torproject.org>2023-06-13 18:18:46 +0000
commit5d63842e86d60e2efdede4dd7afe25666eb86b9d (patch)
tree241766cae93644782932982db2691f2ea140b770
parentdbd37c0e7bb872208d4282d58f5b66d2fced781f (diff)
downloadtor-5d63842e86d60e2efdede4dd7afe25666eb86b9d.tar.gz
tor-5d63842e86d60e2efdede4dd7afe25666eb86b9d.zip
Bug 40810: Avoid using 0 RTT legs
-rw-r--r--src/core/or/conflux.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/core/or/conflux.c b/src/core/or/conflux.c
index 3330de81ba..c979077e1f 100644
--- 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);