move lan-mouse protocol to separate crate (#178)

This commit is contained in:
Ferdinand Schober
2024-08-11 16:51:47 +02:00
committed by GitHub
parent fe06ca1fae
commit 19c2c4327f
28 changed files with 451 additions and 545 deletions

View File

@@ -1,9 +1,8 @@
use std::{net::SocketAddr, time::Duration};
use lan_mouse_proto::ProtoEvent;
use tokio::{sync::mpsc::Sender, task::JoinHandle};
use input_event::Event;
use crate::client::ClientHandle;
use super::{capture_task::CaptureRequest, emulation_task::EmulationRequest, Server, State};
@@ -12,7 +11,7 @@ const MAX_RESPONSE_TIME: Duration = Duration::from_millis(500);
pub(crate) fn new(
server: Server,
sender_ch: Sender<(Event, SocketAddr)>,
sender_ch: Sender<(ProtoEvent, SocketAddr)>,
emulate_notify: Sender<EmulationRequest>,
capture_notify: Sender<CaptureRequest>,
) -> JoinHandle<()> {
@@ -27,7 +26,7 @@ pub(crate) fn new(
async fn ping_task(
server: &Server,
sender_ch: Sender<(Event, SocketAddr)>,
sender_ch: Sender<(ProtoEvent, SocketAddr)>,
emulate_notify: Sender<EmulationRequest>,
capture_notify: Sender<CaptureRequest>,
) {
@@ -86,7 +85,7 @@ async fn ping_task(
// ping clients
for addr in ping_addrs {
if sender_ch.send((Event::Ping(), addr)).await.is_err() {
if sender_ch.send((ProtoEvent::Ping, addr)).await.is_err() {
break;
}
}