From: Matt Joiner Date: Tue, 12 Aug 2025 13:31:18 +0000 (+1000) Subject: Fix AllowDataDownload not triggering piece request state X-Git-Tag: v1.59.0~2^2~27 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=e25ad95d6d7d259553e3651ca8950bc5f8641e60;p=btrtrc.git Fix AllowDataDownload not triggering piece request state --- 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) }