fix: transactional pause
This commit is contained in:
parent
7147313846
commit
b105a3bb22
1 changed files with 12 additions and 1 deletions
|
|
@ -1365,8 +1365,19 @@ impl Session {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn pause(&self, handle: &ManagedTorrentHandle) -> anyhow::Result<()> {
|
pub async fn pause(&self, handle: &ManagedTorrentHandle) -> anyhow::Result<()> {
|
||||||
|
let mut g = handle.locked.write();
|
||||||
|
let prev = g.paused;
|
||||||
|
g.paused = true;
|
||||||
|
drop(g);
|
||||||
|
|
||||||
handle.locked.write().paused = true;
|
handle.locked.write().paused = true;
|
||||||
handle.pause()?;
|
match handle.pause() {
|
||||||
|
Ok(()) => {}
|
||||||
|
Err(err) => {
|
||||||
|
handle.locked.write().paused = prev;
|
||||||
|
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