allow cancelling session creation

This commit is contained in:
Ferdinand Schober
2024-07-12 12:31:39 +02:00
parent 8908c33603
commit fa57b4ea34
4 changed files with 21 additions and 19 deletions

View File

@@ -99,7 +99,14 @@ async fn do_capture(
frontend_tx: &Sender<FrontendEvent>,
release_bind: &[scancode::Linux],
) -> Result<(), LanMouseCaptureError> {
let mut capture = input_capture::create(backend).await?;
/* allow cancelling capture request */
let mut capture = tokio::select! {
r = input_capture::create(backend) => {
r?
},
_ = server.cancelled() => return Ok(()),
};
let _ = frontend_tx
.send(FrontendEvent::CaptureStatus(Status::Enabled))
.await;