Initialization progress reporting
This commit is contained in:
parent
b79a21179f
commit
876afbf41b
9 changed files with 109 additions and 40 deletions
|
|
@ -2,7 +2,10 @@ use std::{
|
|||
fs::File,
|
||||
io::{Read, Seek, SeekFrom, Write},
|
||||
marker::PhantomData,
|
||||
sync::Arc,
|
||||
sync::{
|
||||
atomic::{AtomicU64, Ordering},
|
||||
Arc,
|
||||
},
|
||||
};
|
||||
|
||||
use anyhow::Context;
|
||||
|
|
@ -67,6 +70,7 @@ impl<'a, Sha1Impl: ISha1> FileOps<'a, Sha1Impl> {
|
|||
pub fn initial_check(
|
||||
&self,
|
||||
only_files: Option<&[usize]>,
|
||||
progress: &AtomicU64,
|
||||
) -> anyhow::Result<InitialCheckResults> {
|
||||
let mut needed_pieces = BF::from_vec(vec![0u8; self.lengths.piece_bitfield_bytes()]);
|
||||
let mut have_pieces = BF::from_vec(vec![0u8; self.lengths.piece_bitfield_bytes()]);
|
||||
|
|
@ -125,6 +129,7 @@ impl<'a, Sha1Impl: ISha1> FileOps<'a, Sha1Impl> {
|
|||
let mut piece_remaining = piece_info.len as usize;
|
||||
let mut some_files_broken = false;
|
||||
let mut at_least_one_file_required = current_file.full_file_required;
|
||||
progress.fetch_add(piece_info.len as u64, Ordering::Relaxed);
|
||||
|
||||
while piece_remaining > 0 {
|
||||
let mut to_read_in_file =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue