]> Sergey Matveev's repositories - btrtrc.git/commitdiff
More explicit implementation for wantPiece method
authorMatt Joiner <anacrolix@gmail.com>
Tue, 22 Oct 2013 07:03:44 +0000 (18:03 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Tue, 22 Oct 2013 07:03:44 +0000 (18:03 +1100)
client.go

index 322a21514db0a4f73059c57a91cbb49a4901b817..b7d4e09f977f831d8849594b7b21f2057fc863e4 100644 (file)
--- a/client.go
+++ b/client.go
@@ -621,7 +621,8 @@ func (me *Client) peerGotPiece(torrent *Torrent, conn *Connection, piece int) {
 }
 
 func (t *Torrent) wantPiece(index int) bool {
-       return !t.Pieces[index].Complete()
+       p := t.Pieces[index]
+       return p.EverHashed && !p.Hashing && len(p.PendingChunkSpecs) != 0
 }
 
 func (me *Client) peerUnchoked(torrent *Torrent, conn *Connection) {