Skip to content

Commit

Permalink
feat: remove drop
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrreadiness committed Oct 12, 2024
1 parent b105a3b commit bbdb78f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions crates/librqbit/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1365,16 +1365,17 @@ impl Session {
}

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

handle.locked.write().paused = true;
match handle.pause() {
Ok(()) => {}
Err(err) => {
handle.locked.write().paused = prev;
handle.locked.write().paused = prev_state;
return Err(err);
}
}
Expand Down

0 comments on commit bbdb78f

Please sign in to comment.