Move on_piece_completed() to a more appropriate place

This commit is contained in:
Igor Katson 2024-09-13 09:25:52 +01:00
parent 88c8e51ab8
commit 8974a013ce
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
2 changed files with 3 additions and 2 deletions

View file

@ -719,6 +719,9 @@ impl TorrentStateLive {
}
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 locked = &mut **g;
let chunks = locked.get_chunks_mut()?;