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<()> {
|
pub async fn pause(&self, handle: &ManagedTorrentHandle) -> anyhow::Result<()> {
|
||||||
let prev_state;
|
handle.pause().map(|_| handle.locked.write().paused = true)?;
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.try_update_persistence_metadata(handle).await;
|
self.try_update_persistence_metadata(handle).await;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue