From: Matt Joiner Date: Tue, 22 Oct 2013 07:03:44 +0000 (+1100) Subject: More explicit implementation for wantPiece method X-Git-Tag: v1.0.0~1789 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=36b36beb3b9299b0f1369f9a416d042676c98d1b;p=btrtrc.git More explicit implementation for wantPiece method --- 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) {