]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Torrent.unpendPieces: Only update unpended pieces
authorMatt Joiner <anacrolix@gmail.com>
Mon, 31 Oct 2016 08:05:08 +0000 (19:05 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 31 Oct 2016 08:05:08 +0000 (19:05 +1100)
Updating all pieces at once is no longer faster. (There was an optimization for this a while ago that no longer exists.)

torrent.go

index d53efb0acb96ec75fe4ebc17b84e9b53cb755cd2..d0f81fd7f1bc3a2628ca5abd3616b0d486b74e1e 100644 (file)
@@ -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) {