From dc2b622be1e0ecae572cda1a5e301654608616b2 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Sun, 14 Sep 2014 03:57:51 +1000 Subject: [PATCH] Track failed piece hashes --- client.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client.go b/client.go index 5b161293..b8fbdb80 100644 --- a/client.go +++ b/client.go @@ -56,6 +56,7 @@ var ( unexpectedCancels = expvar.NewInt("unexpectedCancels") postedCancels = expvar.NewInt("postedCancels") duplicateConnsAvoided = expvar.NewInt("duplicateConnsAvoided") + failedPieceHashes = expvar.NewInt("failedPieceHashes") ) const ( @@ -1451,6 +1452,10 @@ func (me *Client) DataWaiter(ih InfoHash, off int64) (ret <-chan struct{}) { func (me *Client) pieceHashed(t *torrent, piece pp.Integer, correct bool) { p := t.Pieces[piece] + if p.EverHashed && !correct { + log.Printf("%s: piece %d failed hash", t, piece) + failedPieceHashes.Add(1) + } p.EverHashed = true if correct { p.PendingChunkSpecs = nil