Skip to content

Commit

Permalink
fix: simlify
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrreadiness committed Oct 12, 2024
1 parent bbdb78f commit be9716e
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions crates/librqbit/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1365,20 +1365,7 @@ impl Session {
}

pub async fn pause(&self, handle: &ManagedTorrentHandle) -> anyhow::Result<()> {
let prev_state;
{
let mut g = handle.locked.write();
prev_state = g.paused;
g.paused = true;
}

match handle.pause() {
Ok(()) => {}
Err(err) => {
handle.locked.write().paused = prev_state;
return Err(err);
}
}
handle.pause().map(|_| handle.locked.write().paused = true)?;
self.try_update_persistence_metadata(handle).await;
Ok(())
}
Expand Down

0 comments on commit be9716e

Please sign in to comment.