From 062696d31cc21e37b44e8c23e40ece9076cc22e5 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Thu, 5 Nov 2026 14:03:47 +0100 Subject: Fix: Restoring a state file doubled every completed count --- src/trackerlogic.c | 1 - tests/integration/test_statefile.py | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/trackerlogic.c b/src/trackerlogic.c index 60d5b18..e29ca11 100644 --- a/src/trackerlogic.c +++ b/src/trackerlogic.c @@ -76,7 +76,6 @@ void add_torrent_from_saved_state(ot_hash const hash, ot_time age, size_t down_c torrent->peer_list6->base = time_now_minutes() - age; torrent->peer_list4->base = time_now_minutes() - age; torrent->peer_list6->down_count = down_count; - torrent->peer_list4->down_count = down_count; mutex_bucket_unlock_by_hash(hash, 1); } diff --git a/tests/integration/test_statefile.py b/tests/integration/test_statefile.py index 2a2d147..9f6db01 100644 --- a/tests/integration/test_statefile.py +++ b/tests/integration/test_statefile.py @@ -30,6 +30,7 @@ class StateFileRoundTrip(TrackerTestCase): files = restarted.scrape(info_hash)[b"files"] self.assertIn(info_hash, files, "the torrent did not survive the restart") entry = files[info_hash] + self.assertEqual(entry[b"downloaded"], 1, "the completed count did not survive") self.assertEqual(entry[b"complete"], 0, "no peers are carried over, only the torrent") self.assertEqual(entry[b"incomplete"], 0) complaints = restarted.stop() -- cgit v1.3