From 4b06bb588d3c0062510cad619a73365dcc2fd767 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Wed, 13 Aug 2025 00:28:21 +1000 Subject: [PATCH] Use ignorePieceForRequests instead of shady pending pieces --- torrent.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/torrent.go b/torrent.go index 3436e9ec..9c8d534f 100644 --- a/torrent.go +++ b/torrent.go @@ -1323,7 +1323,6 @@ func (t *Torrent) hashPieceWithSpecificHash(piece pieceIndex, h hash.Hash) ( storagePiece := p.Storage() var written int64 written, err = storagePiece.WriteTo(w) - // TODO: Require the correct number of bytes were written to pass hash. t.countBytesHashed(written) return } @@ -2662,7 +2661,7 @@ func (t *Torrent) onIncompletePiece(piece pieceIndex) { if t.pieceAllDirty(piece) { t.pendAllChunkSpecs(piece) } - if !t.wantPieceIndex(piece) { + if t.ignorePieceForRequests(piece) { // t.logger.Printf("piece %d incomplete and unwanted", piece) return } @@ -3564,7 +3563,7 @@ func (t *Torrent) endRequestIndexForFileIndex(fileIndex int) RequestIndex { func (t *Torrent) wantReceiveChunk(reqIndex RequestIndex) bool { pi := t.pieceIndexOfRequestIndex(reqIndex) - if !t.wantPieceIndex(pi) { + if t.ignorePieceForRequests(pi) { return false } if t.haveRequestIndexChunk(reqIndex) { -- 2.51.0