From 859bec5df8ea7509135d76a707c391de8315137a Mon Sep 17 00:00:00 2001 From: Ferdinand Schober Date: Tue, 24 Sep 2024 19:22:17 +0200 Subject: [PATCH] remove some debug logs --- input-capture/src/lib.rs | 1 - src/capture.rs | 12 +++++++----- src/connect.rs | 1 - src/emulation.rs | 6 +----- src/listen.rs | 6 +----- 5 files changed, 9 insertions(+), 17 deletions(-) diff --git a/input-capture/src/lib.rs b/input-capture/src/lib.rs index 2b7de95..debfd6d 100644 --- a/input-capture/src/lib.rs +++ b/input-capture/src/lib.rs @@ -167,7 +167,6 @@ impl InputCapture { /// release mouse pub async fn release(&mut self) -> Result<(), CaptureError> { - log::info!("RELEASE CAPTURE"); self.pressed_keys.clear(); self.capture.release().await } diff --git a/src/capture.rs b/src/capture.rs index fd4d751..7703373 100644 --- a/src/capture.rs +++ b/src/capture.rs @@ -130,7 +130,10 @@ async fn do_capture( match event { // connection acknowlegded => set state to Sending - ProtoEvent::Ack(_) => state = State::Sending, + ProtoEvent::Ack(_) => { + log::info!("client {handle} acknowledged the connection!"); + state = State::Sending; + } // client disconnected ProtoEvent::Leave(_) => release_capture(&mut capture, server).await?, _ => {} @@ -207,6 +210,7 @@ async fn handle_capture_event( if event == CaptureEvent::Begin && Some(handle) != server.get_active() { *state = State::WaitingForAck; server.set_active(Some(handle)); + log::info!("entering client {handle} ..."); spawn_hook_command(server, handle); } @@ -219,11 +223,9 @@ async fn handle_capture_event( }, }; - log::info!("CAPTURE {event} >=>=>=>=>=> {handle}"); if let Err(e) = conn.send(event, handle).await { - // const DUR: Duration = Duration::from_millis(500); - log::warn!("releasing capture: {e}"); - // debounce!(PREV_LOG, DUR, log::warn!("releasing capture: {e}")); + const DUR: Duration = Duration::from_millis(500); + debounce!(PREV_LOG, DUR, log::warn!("releasing capture: {e}")); capture.release().await?; } Ok(()) diff --git a/src/connect.rs b/src/connect.rs index 9228c71..ba4ad5e 100644 --- a/src/connect.rs +++ b/src/connect.rs @@ -96,7 +96,6 @@ impl LanMouseConnection { ) -> Result<(), LanMouseConnectionError> { let (buf, len): ([u8; MAX_EVENT_SIZE], usize) = event.into(); let buf = &buf[..len]; - log::info!("{event} =>=>=>=>=>=> {handle}"); if let Some(addr) = self.server.active_addr(handle) { let conn = { let conns = self.conns.lock().await; diff --git a/src/emulation.rs b/src/emulation.rs index 14c673b..e68b564 100644 --- a/src/emulation.rs +++ b/src/emulation.rs @@ -41,11 +41,7 @@ impl Emulation { Some(e) => e, None => break, }; - if let ProtoEvent::Ping = event { - log::trace!("{event} <-<-<-<-<- {addr}"); - } else { - log::info!("{event} <-<-<-<-<- {addr}"); - } + log::trace!("{event} <-<-<-<-<- {addr}"); last_response.insert(addr, Instant::now()); match event { ProtoEvent::Enter(_) => { diff --git a/src/listen.rs b/src/listen.rs index 1d59b1c..365718b 100644 --- a/src/listen.rs +++ b/src/listen.rs @@ -96,11 +96,7 @@ impl LanMouseListener { } pub(crate) async fn reply(&self, addr: SocketAddr, event: ProtoEvent) { - if let ProtoEvent::Pong = event { - log::trace!("reply {event} >=>=>=>=>=> {addr}"); - } else { - log::info!("reply {event} >=>=>=>=>=> {addr}"); - } + log::trace!("reply {event} >=>=>=>=>=> {addr}"); let (buf, len): ([u8; MAX_EVENT_SIZE], usize) = event.into(); let conns = self.conns.lock().await; for (a, conn) in conns.iter() {