This commit is contained in:
Ferdinand Schober
2024-07-11 16:59:09 +02:00
parent 4c30f032f4
commit 69a5eec944
4 changed files with 24 additions and 35 deletions

View File

@@ -48,9 +48,9 @@ pub enum CaptureEvent {
pub fn new(
backend: Option<CaptureBackend>,
server: Server,
sender_tx: Sender<(Event, SocketAddr)>,
udp_send: Sender<(Event, SocketAddr)>,
frontend_tx: Sender<FrontendEvent>,
timer_notify: Arc<Notify>,
notify_ping: Arc<Notify>,
release_bind: Vec<scancode::Linux>,
cancellation_token: CancellationToken,
notify_capture: Arc<Notify>,
@@ -60,10 +60,10 @@ pub fn new(
let task = tokio::task::spawn_local(capture_task(
backend,
server,
sender_tx,
udp_send,
rx,
frontend_tx,
timer_notify,
notify_ping,
release_bind,
cancellation_token,
notify_capture,

View File

@@ -170,7 +170,7 @@ async fn do_emulation(
}
// release potentially still pressed keys
release_all_keys(&server, &mut emulation).await?;
release_all_keys(server, &mut emulation).await?;
Ok(())
}

View File

@@ -23,13 +23,12 @@ pub fn new(
cancellation_token: CancellationToken,
) -> JoinHandle<()> {
// timer task
let ping_task = tokio::task::spawn_local(async move {
tokio::task::spawn_local(async move {
tokio::select! {
_ = cancellation_token.cancelled() => {}
_ = ping_task(server, sender_ch, emulate_notify, capture_notify, timer_notify) => {}
}
});
ping_task
})
}
async fn ping_task(