From df60a765a75dc5b9ca68650d9820fe29653bc878 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 31 Oct 2016 19:05:08 +1100 Subject: [PATCH] Torrent.unpendPieces: Only update unpended pieces Updating all pieces at once is no longer faster. (There was an optimization for this a while ago that no longer exists.) --- torrent.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/torrent.go b/torrent.go index d53efb0a..d0f81fd7 100644 --- a/torrent.go +++ b/torrent.go @@ -982,7 +982,10 @@ func (t *Torrent) getCompletedPieces() (ret bitmap.Bitmap) { func (t *Torrent) unpendPieces(unpend *bitmap.Bitmap) { t.pendingPieces.Sub(unpend) - t.updatePiecePriorities() + unpend.IterTyped(func(piece int) (again bool) { + t.updatePiecePriority(piece) + return true + }) } func (t *Torrent) pendPieceRange(begin, end int) { -- 2.50.0