From: Matt Joiner Date: Mon, 1 Jun 2015 08:23:35 +0000 (+1000) Subject: Changes to the way piece prioritization affects the piece X-Git-Tag: v1.0.0~1172 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=5b527695234d8913e105884984495cc61e49a3d9;p=btrtrc.git Changes to the way piece prioritization affects the piece --- diff --git a/client.go b/client.go index 1b8dbe0d..29e0f1ef 100644 --- a/client.go +++ b/client.go @@ -344,9 +344,14 @@ func (cl *Client) prioritizePiece(t *torrent, piece int, priority piecePriority) if t.havePiece(piece) { return } - cl.queueFirstHash(t, piece) - t.Pieces[piece].Priority = priority - cl.pieceChanged(t, piece) + if priority != PiecePriorityNone { + cl.queueFirstHash(t, piece) + } + p := t.Pieces[piece] + if p.Priority != priority { + p.Priority = priority + cl.pieceChanged(t, piece) + } } func (cl *Client) setEnvBlocklist() (err error) {