fix edge case where cancellation is not possible

This commit is contained in:
Ferdinand Schober
2024-07-12 18:07:28 +02:00
parent 69afbe1674
commit aea4d0f3fb
2 changed files with 13 additions and 2 deletions

View File

@@ -59,7 +59,12 @@ async fn capture_task(
if server.is_cancelled() {
break;
}
server.capture_notified().await;
// allow cancellation
tokio::select! {
_ = server.capture_notified() => {},
_ = server.cancelled() => break,
}
}
}

View File

@@ -69,7 +69,13 @@ async fn emulation_task(
break;
}
log::info!("waiting for user to request input emulation ...");
server.emulation_notified().await;
// allow cancellation
tokio::select! {
_ = server.emulation_notified() => {},
_ = server.cancelled() => break,
}
log::info!("... done");
}
}