From 5b527695234d8913e105884984495cc61e49a3d9 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Mon, 1 Jun 2015 18:23:35 +1000 Subject: [PATCH] Changes to the way piece prioritization affects the piece --- client.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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) { -- 2.48.1