fix: simlify
This commit is contained in:
parent
bbdb78f773
commit
be9716e6a7
1 changed files with 1 additions and 14 deletions
|
|
@ -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(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue