From 952da5949f677e932f2a48a5474210df571472fb Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sun, 29 Nov 2026 00:34:40 +0100 Subject: Warn about udp addresses already taken by other tracker instances --- tests/integration/test_udp.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'tests/integration/test_udp.py') diff --git a/tests/integration/test_udp.py b/tests/integration/test_udp.py index b60bd56..8a255ec 100644 --- a/tests/integration/test_udp.py +++ b/tests/integration/test_udp.py @@ -9,7 +9,7 @@ import socket import struct import unittest -from harness import TrackerTestCase +from harness import Tracker, TrackerTestCase MAGIC = 0x41727101980 @@ -199,3 +199,20 @@ class UdpWorkersConfiguredAfterTheListener(TrackerTestCase): if __name__ == "__main__": unittest.main() + + +class UdpAddressAlreadyTaken(TrackerTestCase): + def test_a_second_tracker_on_the_same_udp_address_says_so(self): + """Linux lets it start all the same, and from then on the two take + each other's packets. FreeBSD refuses the bind that follows, and the + warning is then what explains the refusal.""" + try: + second = Tracker("listen.udp 127.0.0.1:%d\n" % self.tracker.port) + except AssertionError as refused: + said = str(refused) + else: + said = second.output() + second.stop() + second._cleanup() + self.assertIn("is already in use", said) + self.assertNotIn("is already in use", self.tracker.output()) -- cgit v1.3