From: Matt Joiner Date: Mon, 1 Feb 2016 17:45:57 +0000 (+1100) Subject: Fix bug in readahead X-Git-Tag: v1.0.0~924 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=89f23c226cdc6922ddedb91f73dea38bc140af8c;p=btrtrc.git Fix bug in readahead --- diff --git a/torrent.go b/torrent.go index 48fce3ff..fd462e1f 100644 --- a/torrent.go +++ b/torrent.go @@ -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