Move on_piece_completed() to a more appropriate place
This commit is contained in:
parent
88c8e51ab8
commit
8974a013ce
2 changed files with 3 additions and 2 deletions
|
|
@ -208,8 +208,6 @@ impl<'a> FileOps<'a> {
|
||||||
format!("error reading {to_read_in_file} bytes, file_id: {file_idx} (\"{name:?}\")")
|
format!("error reading {to_read_in_file} bytes, file_id: {file_idx} (\"{name:?}\")")
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
self.files.on_piece_completed(piece_index)?;
|
|
||||||
|
|
||||||
piece_remaining_bytes -= to_read_in_file;
|
piece_remaining_bytes -= to_read_in_file;
|
||||||
|
|
||||||
if piece_remaining_bytes == 0 {
|
if piece_remaining_bytes == 0 {
|
||||||
|
|
|
||||||
|
|
@ -719,6 +719,9 @@ impl TorrentStateLive {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_piece_completed(&self, id: ValidPieceIndex) -> anyhow::Result<()> {
|
fn on_piece_completed(&self, id: ValidPieceIndex) -> anyhow::Result<()> {
|
||||||
|
if let Err(e) = self.files.on_piece_completed(id) {
|
||||||
|
debug!(?id, "file storage errored in on_piece_completed(): {e:#}");
|
||||||
|
}
|
||||||
let mut g = self.lock_write("on_piece_completed");
|
let mut g = self.lock_write("on_piece_completed");
|
||||||
let locked = &mut **g;
|
let locked = &mut **g;
|
||||||
let chunks = locked.get_chunks_mut()?;
|
let chunks = locked.get_chunks_mut()?;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue