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 --- DESIGN | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'DESIGN') diff --git a/DESIGN b/DESIGN index 2e1883e..7933223 100644 --- a/DESIGN +++ b/DESIGN @@ -214,6 +214,16 @@ packet arriving in that window created the torrent, and the saved state for it was then dropped on the exactmatch add_torrent_from_saved_state bails on, losing that torrent's completed count. +A udp address somebody else holds is warned about and bound all the same. +Linux permits the second bind when both sockets set SO_REUSEADDR, which the +tracker always does, and FreeBSD when both asked to share the port, which it +does for a group of workers. The two then take or split each other's datagrams +without either noticing. Every udp entry is probed before the first of them is +bound, with a socket that asks for no sharing, so that an overlap within the +tracker's own configuration is not mistaken for a stranger. TCP is not probed: +there the bind itself fails unless a balanced group was asked for, and on +Linux a probe would also trip over the connections a restart leaves behind. + Teardown stops the cleaner first. It is the one worker that calls into other modules, accesslist_cleanup and stats_cleanup, so stopping it after them left it locking a mutex accesslist_deinit had already destroyed: five shutdowns in -- cgit v1.3