From 36b36beb3b9299b0f1369f9a416d042676c98d1b Mon Sep 17 00:00:00 2001
From: Matt Joiner <anacrolix@gmail.com>
Date: Tue, 22 Oct 2013 18:03:44 +1100
Subject: [PATCH] More explicit implementation for wantPiece method

---
 client.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/client.go b/client.go
index 322a2151..b7d4e09f 100644
--- 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) {
-- 
2.51.0