aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2022-08-02 15:31:00 -0400
committerDavid Goulet <dgoulet@torproject.org>2022-08-02 15:31:00 -0400
commitf51c68729fbd75cbadabb28999b3677ad58b4d69 (patch)
treea11d08f7062dbacd73bf1d8bebd58056bc558235 /src
parent22cb4c23d0d23dfda2c91817bac74a01831f94af (diff)
parentaf5ef98d1b2221ee4da389bb88dfe1c991d42e8d (diff)
downloadtor-f51c68729fbd75cbadabb28999b3677ad58b4d69.tar.gz
tor-f51c68729fbd75cbadabb28999b3677ad58b4d69.zip
Merge branch 'maint-0.4.7'
Diffstat (limited to 'src')
-rw-r--r--src/core/or/congestion_control_common.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core/or/congestion_control_common.c b/src/core/or/congestion_control_common.c
index 71cd666ee2..42f816690f 100644
--- a/src/core/or/congestion_control_common.c
+++ b/src/core/or/congestion_control_common.c
@@ -882,10 +882,19 @@ congestion_control_update_circuit_bdp(congestion_control_t *cc,
if (!cc->ewma_rtt_usec) {
uint64_t cwnd = cc->cwnd;
+ tor_assert_nonfatal(cc->cwnd <= cwnd_max);
+
/* If the channel is blocked, keep subtracting off the chan_q
* until we hit the min cwnd. */
if (blocked_on_chan) {
- cwnd = MAX(cwnd - chan_q, cc->cwnd_min);
+ /* Cast is fine because we're less than int32 */
+ if (chan_q >= (int64_t)cwnd) {
+ log_notice(LD_CIRC,
+ "Clock stall with large chanq: %d %"PRIu64, chan_q, cwnd);
+ cwnd = cc->cwnd_min;
+ } else {
+ cwnd = MAX(cwnd - chan_q, cc->cwnd_min);
+ }
cc->blocked_chan = 1;
} else {
cc->blocked_chan = 0;