]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Changes to the way piece prioritization affects the piece
authorMatt Joiner <anacrolix@gmail.com>
Mon, 1 Jun 2015 08:23:35 +0000 (18:23 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 1 Jun 2015 08:23:35 +0000 (18:23 +1000)
client.go

index 1b8dbe0d11b318e9c9ab0d8450f3c1894724f8f8..29e0f1ef2c7001d5673a8e23cf65ad3f8db0c2ab 100644 (file)
--- 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) {