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.
}
func (t *Torrent) onPieceCompleted(piece int) {
- t.pendingPieces.Remove(piece)
t.pendAllChunkSpecs(piece)
t.cancelRequestsForPiece(piece)
for conn := range t.conns {