Add missing increments to some stats
This commit is contained in:
parent
5a4e8cd4c5
commit
9567aa901c
|
@ -948,6 +948,7 @@ func (cl *Client) gotMetadataExtensionMsg(payload []byte, t *Torrent, c *connect
|
|||
}
|
||||
t.saveMetadataPiece(piece, payload[begin:])
|
||||
c.stats.ChunksReadUseful++
|
||||
c.t.stats.ChunksReadUseful++
|
||||
c.lastUsefulChunkReceived = time.Now()
|
||||
return t.maybeCompleteMetadata()
|
||||
case pp.RequestMetadataExtensionMsgType:
|
||||
|
|
|
@ -1080,6 +1080,7 @@ func (c *connection) receiveChunk(msg *pp.Message) {
|
|||
if !t.wantPiece(req) {
|
||||
unwantedChunksReceived.Add(1)
|
||||
c.stats.ChunksReadUnwanted++
|
||||
c.t.stats.ChunksReadUnwanted++
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -1087,6 +1088,9 @@ func (c *connection) receiveChunk(msg *pp.Message) {
|
|||
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)
|
||||
|
|
|
@ -1514,6 +1514,9 @@ func (t *Torrent) pieceHashed(piece int, correct bool) {
|
|||
}
|
||||
p.everHashed = true
|
||||
if correct {
|
||||
if len(touchers) != 0 {
|
||||
t.stats.PiecesDirtiedGood++
|
||||
}
|
||||
for _, c := range touchers {
|
||||
c.stats.PiecesDirtiedGood++
|
||||
}
|
||||
|
@ -1523,6 +1526,7 @@ func (t *Torrent) pieceHashed(piece int, correct bool) {
|
|||
}
|
||||
} else {
|
||||
if len(touchers) != 0 {
|
||||
t.stats.PiecesDirtiedBad++
|
||||
for _, c := range touchers {
|
||||
// Y u do dis peer?!
|
||||
c.stats.PiecesDirtiedBad++
|
||||
|
|
Loading…
Reference in New Issue