]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Remove premature update to piece priority after piece is completed
authorMatt Joiner <anacrolix@gmail.com>
Sun, 28 Jan 2018 04:52:14 +0000 (15:52 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Sun, 28 Jan 2018 04:52:14 +0000 (15:52 +1100)
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

index 18176156db4ba0ab1ee69dccf26d6ca6a1926b87..7063969b0bc6a873c042b16b53f73ef2308095f8 100644 (file)
@@ -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 {