use local-channel instead of tokio sync channel (#179)

this avoids the mutex overhead in tokio
This commit is contained in:
Ferdinand Schober
2024-08-12 18:20:21 +02:00
committed by GitHub
parent 19c2c4327f
commit e7a1d72149
8 changed files with 54 additions and 61 deletions

View File

@@ -1,12 +1,9 @@
use futures::StreamExt;
use lan_mouse_proto::ProtoEvent;
use local_channel::mpsc::{Receiver, Sender};
use std::net::SocketAddr;
use tokio::{
process::Command,
sync::mpsc::{Receiver, Sender},
task::JoinHandle,
};
use tokio::{process::Command, task::JoinHandle};
use input_capture::{
self, CaptureError, CaptureEvent, CaptureHandle, InputCapture, InputCaptureError, Position,
@@ -161,7 +158,7 @@ async fn handle_capture_event(
/* released capture */
State::Receiving => ProtoEvent::Leave(0),
};
sender_tx.send((event, addr)).await.expect("sender closed");
sender_tx.send((event, addr)).expect("sender closed");
};
Ok(())