Skip to content

Commit

Permalink
added hash/complete counts
Browse files Browse the repository at this point in the history
  • Loading branch information
mh0lt committed Jul 20, 2024
1 parent 89e3cd7 commit 7607773
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions t.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,14 @@ func (t *Torrent) DownloadPieces(begin, end pieceIndex) {

if checkCompletion && !storage.IsNew() {
if sum, _, err := t.hashPiece(piece); err == nil && sum == *piece.hash {
size := int64(piece.length(true))
t.allStats(func(cs *ConnStats) {
cs.pieceHashed(size)
})
storage.MarkComplete(false)
t.allStats(func(cs *ConnStats) {
cs.pieceCompleted(size)
})
t.updatePieceCompletion(piece.index, true)
return nil
}
Expand Down

0 comments on commit 7607773

Please sign in to comment.