Skip to content

Commit

Permalink
Remove state unwrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanjermakov committed Oct 29, 2023
1 parent e4d6bbd commit 5955127
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/torrent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,7 @@ pub async fn download_torrent(
trace!("aborting tracker loop");
let _ = tracker_loop_h.ensure_abort().await;

trace!("unwrapping state");
let state = Arc::try_unwrap(state)
.map_err(|_| Error::msg("dangling state reference"))?
.into_inner();

let state = state.lock().await;
debug!("verifying downloaded pieces");
ensure!(
state.pieces.len() == state.metainfo.info.pieces.len(),
Expand Down

0 comments on commit 5955127

Please sign in to comment.