swarm: re-announce promptly when the swarm is starved

The peer top-up loop re-announced to trackers only at the full advertised
interval (~30 min), so a torrent that dropped to a handful of peers would
sit there for up to half an hour with only the 5-minute DHT refresh to
help — looking like the re-announce system was dead.

Now, when fewer than LOW_PEER_THRESHOLD (10) peers are connected, the next
tracker announce is scheduled at the tracker's min_interval floor (never
below 60s) instead of the full interval, so a thin swarm actually tries to
recover. Once peers recover the full interval is used again. Capture the
tracker's min_interval (was being dropped) to stay announce-compliant.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ookami125 2026-06-24 20:04:24 -04:00
parent a0265cc1ea
commit 096535292d
3 changed files with 38 additions and 14 deletions

View file

@ -29,6 +29,7 @@ typedef struct {
typedef struct {
int32_t interval;
int32_t min_interval; /* tracker's floor, 0 if not advertised */
int32_t seeders, leechers; /* -1 if absent */
naut_peer_addr *peers;
size_t num_peers;