tor

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

commit 90b562b2ebe5cd69589f3da2f5778a0ba10d170f
parent 09c22a187b8640b8dde7f132b7477323c298cdd5
Author: David Goulet <dgoulet@torproject.org>
Date:   Mon, 10 Nov 2025 14:40:37 -0500

relay: Fix have_been_under_memory_pressure() on startup

Until we hit the OOM handler, "last_time_under_memory_pressure" is set to 0 and
thus have_been_under_memory_pressure() would always return true because 0 +
some interval is always smaller than now().

Signed-off-by: David Goulet <dgoulet@torproject.org>

Diffstat:
Msrc/core/or/relay.c | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/core/or/relay.c b/src/core/or/relay.c @@ -2988,6 +2988,9 @@ cell_queues_check_size(void) int have_been_under_memory_pressure(void) { + if (last_time_under_memory_pressure == 0) { + return false; + } return last_time_under_memory_pressure + MEMORY_PRESSURE_INTERVAL < approx_time(); }