]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Avoid copying mutex in piece
authorMatt Joiner <anacrolix@gmail.com>
Thu, 29 Oct 2015 14:16:52 +0000 (01:16 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 29 Oct 2015 14:16:52 +0000 (01:16 +1100)
client.go

index 0385b4fa5b8d0d4b1ac0f751a075cb32fe97eab5..fea00be6a378bc24a0b8429a2d074c7ef8e1d1d6 100644 (file)
--- a/client.go
+++ b/client.go
@@ -1781,7 +1781,8 @@ func (t *torrent) needData() bool {
        if len(t.urgent) != 0 {
                return true
        }
-       for _, p := range t.Pieces {
+       for i := range t.Pieces {
+               p := &t.Pieces[i]
                if p.Priority != PiecePriorityNone {
                        return true
                }