From de928be5828fe66cf0f3c41e1933ecda5ae8a6f6 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Sun, 28 Jan 2018 15:52:14 +1100 Subject: [PATCH] Remove premature update to piece priority after piece is completed This should have prevented Torrent.piecePriorityChanged from being called, meaning requests for the completed piece were not canceled, and the piece remained in connection's piece request queue, which meant wasted effort downloading chunks for an already acquired piece. Thanks to @elgatito for discovering the issue. --- torrent.go | 1 - 1 file changed, 1 deletion(-) diff --git a/torrent.go b/torrent.go index 18176156..7063969b 100644 --- a/torrent.go +++ b/torrent.go @@ -1515,7 +1515,6 @@ func (t *Torrent) cancelRequestsForPiece(piece int) { } func (t *Torrent) onPieceCompleted(piece int) { - t.pendingPieces.Remove(piece) t.pendAllChunkSpecs(piece) t.cancelRequestsForPiece(piece) for conn := range t.conns { -- 2.48.1