From e25ad95d6d7d259553e3651ca8950bc5f8641e60 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Tue, 12 Aug 2025 23:31:18 +1000 Subject: [PATCH] Fix AllowDataDownload not triggering piece request state --- torrent.go | 4 ++++ webseed-peer.go | 1 + 2 files changed, 5 insertions(+) diff --git a/torrent.go b/torrent.go index 5f6c75d0..3436e9ec 100644 --- a/torrent.go +++ b/torrent.go @@ -1570,6 +1570,9 @@ func (t *Torrent) updatePiecePriority(piece pieceIndex, reason updateRequestReas } func (t *Torrent) updateAllPiecePriorities(reason updateRequestReason) { + if !t.haveInfo() { + return + } t.updatePiecePriorities(0, t.numPieces(), reason) } @@ -2997,6 +3000,7 @@ func (t *Torrent) AllowDataDownload() { if !t.dataDownloadDisallowed.Clear() { return } + t.updateAllPiecePriorities("data download allowed") t.iterPeers(func(p *Peer) { p.onNeedUpdateRequests("allow data download") }) diff --git a/webseed-peer.go b/webseed-peer.go index 852716ab..77df4061 100644 --- a/webseed-peer.go +++ b/webseed-peer.go @@ -55,6 +55,7 @@ func (me *webseedPeer) isLowOnRequests() bool { // Webseed requests are issued globally so per-connection reasons or handling make no sense. func (me *webseedPeer) onNeedUpdateRequests(reason updateRequestReason) { // Too many reasons here: Can't predictably determine when we need to rerun updates. + // TODO: Can trigger this when we have Client-level active-requests map. //me.peer.cl.scheduleImmediateWebseedRequestUpdate(reason) } -- 2.51.0