client.go | 1 + connection.go | 4 ++++ torrent.go | 4 ++++ diff --git a/client.go b/client.go index 3072dcd1a6098b8ad58990a142327ab2425ff95a..bab9e5601cabb925b42983552421a15d29f0a368 100644 --- a/client.go +++ b/client.go @@ -948,6 +948,7 @@ return fmt.Errorf("data has bad offset in payload: %d", begin) } t.saveMetadataPiece(piece, payload[begin:]) c.stats.ChunksReadUseful++ + c.t.stats.ChunksReadUseful++ c.lastUsefulChunkReceived = time.Now() return t.maybeCompleteMetadata() case pp.RequestMetadataExtensionMsgType: diff --git a/connection.go b/connection.go index 73d74604549fd2a9a876d10e316ab9532d941b09..c3a566500bd4d4be1a6433a2c2d411440a8187b9 100644 --- a/connection.go +++ b/connection.go @@ -1080,6 +1080,7 @@ // Do we actually want this chunk? if !t.wantPiece(req) { unwantedChunksReceived.Add(1) c.stats.ChunksReadUnwanted++ + c.t.stats.ChunksReadUnwanted++ return } @@ -1087,6 +1088,9 @@ index := int(req.Index) piece := &t.pieces[index] c.stats.ChunksReadUseful++ + c.t.stats.ChunksReadUseful++ + c.stats.BytesReadUsefulData += int64(len(msg.Piece)) + c.t.stats.BytesReadUsefulData += int64(len(msg.Piece)) c.lastUsefulChunkReceived = time.Now() // if t.fastestConn != c { // log.Printf("setting fastest connection %p", c) diff --git a/torrent.go b/torrent.go index 99908a92cd0264744ffdb258d7170523e00f451d..a58d6b8f447f97040222279822d96333776fd0f8 100644 --- a/torrent.go +++ b/torrent.go @@ -1514,6 +1514,9 @@ } } p.everHashed = true if correct { + if len(touchers) != 0 { + t.stats.PiecesDirtiedGood++ + } for _, c := range touchers { c.stats.PiecesDirtiedGood++ } @@ -1523,6 +1526,7 @@ log.Printf("%T: error marking piece complete %d: %s", t.storage, piece, err) } } else { if len(touchers) != 0 { + t.stats.PiecesDirtiedBad++ for _, c := range touchers { // Y u do dis peer?! c.stats.PiecesDirtiedBad++