mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-03-22 12:40:54 +03:00
move lan-mouse protocol to separate crate (#178)
This commit is contained in:
committed by
GitHub
parent
fe06ca1fae
commit
19c2c4327f
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user