From 253432c918dacc8bfd5d9a6a46c45a9dc682c7ec Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Tue, 3 Nov 2026 02:45:55 +0100 Subject: Give the live sync worker a real workstruct --- tests/integration/test_livesync.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/integration/test_livesync.py') diff --git a/tests/integration/test_livesync.py b/tests/integration/test_livesync.py index 8dd754b..1659a41 100644 --- a/tests/integration/test_livesync.py +++ b/tests/integration/test_livesync.py @@ -102,6 +102,17 @@ class LiveSyncIn(TrackerTestCase): self.tracker.livesync_send(packet(99, [(info_hash, peer4("10.1.2.11", 6881, FLAG_SEEDING))])) self.assertFalse(self.tracker.wait_until(lambda: self.counts(info_hash) is not None, timeout=1)) + def test_synced_peers_are_counted(self): + """The live sync worker keeps its own tally like every other worker, + and ?mode=syncs is the sum of them.""" + before = int(self.tracker.stats("syncs").split()[0]) + hashes = [self.hash_for("sync-count-%d" % i) for i in range(3)] + self.tracker.livesync_send(packet(SYNC_PEER4, [(h, peer4("10.1.2.%d" % (20 + i), 6881, FLAG_SEEDING)) + for i, h in enumerate(hashes)])) + self.assertTrue(self.tracker.wait_until( + lambda: int(self.tracker.stats("syncs").split()[0]) == before + 3), + "syncs says %s" % self.tracker.stats("syncs").split()[0]) + def test_a_packet_with_nothing_but_a_header_is_ignored(self): before = self.tracker.torrent_count() self.tracker.livesync_send(struct.pack("!I", 0xDEADBEEF) + struct.pack("!I", SYNC_PEER4)) -- cgit v1.3