]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Fix AllowDataDownload not triggering piece request state
authorMatt Joiner <anacrolix@gmail.com>
Tue, 12 Aug 2025 13:31:18 +0000 (23:31 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Tue, 12 Aug 2025 13:31:18 +0000 (23:31 +1000)
torrent.go
webseed-peer.go

index 5f6c75d0e517fb72ab6f3907b574121bb26c03d8..3436e9ece3a9fd4a6a221895c8572b075cf76da9 100644 (file)
@@ -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")
        })
index 852716ab86073dae2d25c4ba9beae8b4efa2a7e0..77df406149275f10826456400044c0a4a89e571a 100644 (file)
@@ -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)
 }