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

@@ -109,7 +109,12 @@ async fn do_emulation(
) -> Result<(), LanMouseEmulationError> {
let backend = backend.map(|b| b.into());
log::info!("creating input emulation...");
let mut emulation = input_emulation::create(backend).await?;
let mut emulation = tokio::select! {
r = input_emulation::create(backend) => {
r?
}
_ = server.cancelled() => return Ok(()),
};
let _ = frontend_tx
.send(FrontendEvent::EmulationStatus(Status::Enabled))
.await;