Download speed: dont lag behind disk

This commit is contained in:
Igor Katson 2024-05-02 09:10:36 +01:00
parent 648c4edf71
commit d2e37ead51
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5

View file

@ -1368,9 +1368,14 @@ impl PeerHandler {
}
};
// This one is used to calculate download speed.
self.state
.stats
.fetched_bytes
.fetch_add(piece.block.len() as u64, Ordering::Relaxed);
// By this time we reach here, no other peer can for this piece. All others, even if they steal pieces would
// have fallen off above in one of the defensive checks.
self.state
.meta
.spawner
@ -1393,12 +1398,6 @@ impl PeerHandler {
}
}
// Global chunk/byte counters.
self.state
.stats
.fetched_bytes
.fetch_add(piece.block.len() as u64, Ordering::Relaxed);
let full_piece_download_time = match full_piece_download_time {
Some(t) => t,
None => return Ok(()),