From: Matt Joiner Date: Mon, 31 Oct 2016 08:05:08 +0000 (+1100) Subject: Torrent.unpendPieces: Only update unpended pieces X-Git-Tag: v1.0.0~542 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=df60a765a75dc5b9ca68650d9820fe29653bc878;p=btrtrc.git 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.) --- 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) {