Track failed piece hashes

This commit is contained in:
Matt Joiner 2014-09-14 03:57:51 +10:00
parent 97ae59dfaf
commit dc2b622be1
1 changed files with 5 additions and 0 deletions

View File

@ -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