]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Fix bug in readahead
authorMatt Joiner <anacrolix@gmail.com>
Mon, 1 Feb 2016 17:45:57 +0000 (04:45 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 1 Feb 2016 17:45:57 +0000 (04:45 +1100)
torrent.go

index 48fce3ffe20ccf361006810254a31c9c74b9348f..fd462e1f11d7f47681c3a3639b982f09334b51ef 100644 (file)
@@ -882,10 +882,11 @@ func (t *torrent) updatePiecePriorities() {
                        newPrios[begin].Raise(PiecePriorityNow)
                }
                for i := begin + 1; i < end; i++ {
-                       newPrios[begin].Raise(PiecePriorityReadahead)
+                       newPrios[i].Raise(PiecePriorityReadahead)
                }
                return true
        })
+       // TODO: Do I need a pass suppressing stuff that we already have?
        for i, prio := range newPrios {
                if prio != t.Pieces[i].priority {
                        t.Pieces[i].priority = prio