From bbfd674e08c6b1fa4081f9c678fd220bead749d7 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sat, 7 Nov 2026 03:55:27 +0100 Subject: Start to opentracker's memory requirements * peer lists for v4 and v6 are now lazily allocated and, more importantly, will be freed once there are no more peers * The downloaded count is now per torrent and not per peer list anymore, moving in what was alignment loss, anyway * The (now) per torrent downloaded and the per peer list peer and seed count shrunk from size_t to uint32_t * A helper guards accesses to the peer and seed count to prevent null pointer dereferences * The base time also shrank from time_t to uint32_t, minutes since the epoch currently fits in 25 bits --- tests/t_clean.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/t_clean.c b/tests/t_clean.c index 7eca9aa..2fadd03 100644 --- a/tests/t_clean.c +++ b/tests/t_clean.c @@ -11,7 +11,7 @@ #include "trackerlogic.h" #include "test.h" -/* A clock stepped backwards used to leave peer_list->base in the future, so +/* A clock stepped backwards used to leave the torrent's base in the future, so the span the cleaner works from came out negative. It was then added to a peer's age and stored in the single byte that age lives in, where -1 reads as 255 and the next pass threw the whole swarm away. */ @@ -60,14 +60,12 @@ static ot_torrent *torrent_of(ot_hash *hash) { /* What a clock stepped back by `minutes` leaves behind */ static void step_clock_back(ot_torrent *torrent, int minutes) { - torrent->peer_list6->base += minutes; - torrent->peer_list4->base += minutes; + torrent->base += minutes; } /* What the next minute of a well behaved clock looks like */ static void age_by_a_minute(ot_torrent *torrent) { - torrent->peer_list6->base -= 1; - torrent->peer_list4->base -= 1; + torrent->base -= 1; } static void case_a_clock_that_went_back_keeps_the_swarm(void) { -- cgit v1.3