From: Matt Joiner Date: Tue, 12 Aug 2025 14:28:21 +0000 (+1000) Subject: Use ignorePieceForRequests instead of shady pending pieces X-Git-Tag: v1.59.0~2^2~23 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=4b06bb588d3c0062510cad619a73365dcc2fd767;p=btrtrc.git Use ignorePieceForRequests instead of shady pending pieces --- 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) {