From 1e7248b330bde4c70528ccf91535391e19294dc3 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sat, 7 Nov 2026 16:54:36 +0100 Subject: Add a knob to help reducing memory consumption. This time: empty torrents may expire sooner --- src/ot_clean.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/ot_clean.c') diff --git a/src/ot_clean.c b/src/ot_clean.c index 77cb4ba..9e2186f 100644 --- a/src/ot_clean.c +++ b/src/ot_clean.c @@ -16,6 +16,8 @@ #include "ot_vector.h" #include "trackerlogic.h" +ot_time g_empty_torrent_timeout = OT_TORRENT_TIMEOUT; + /* Returns amount of removed peers */ static ssize_t clean_single_bucket(ot_peer *peers, size_t peer_count, size_t peer_size, time_t timedout, size_t *removed_seeders) { ot_peer *last_peer, *insert_point; @@ -106,7 +108,7 @@ int clean_single_torrent(ot_torrent *torrent) { /* Already empty and nothing arrived before the peer timeout: keep it only while a down count is worth remembering */ if (timedout > OT_PEER_TIMEOUT && !torrent->peer_list6 && !torrent->peer_list4) - return torrent->down_count ? 0 : 1; + return (torrent->down_count && timedout <= g_empty_torrent_timeout) ? 0 : 1; /* Peers past the peer timeout are gone regardless, which caps how far the lists are aged in this pass */ -- cgit v1.3