diff --git a/src/coordinator.rs b/src/coordinator.rs index 56c82b0..5557c31 100644 --- a/src/coordinator.rs +++ b/src/coordinator.rs @@ -60,7 +60,7 @@ impl <'a> CoordState<'a> { } pub async fn socket_start(&mut self, conn: String) { - if !(self.sck_recv_alive.load(Ordering::SeqCst) && !self.sck_send_alive.load(Ordering::SeqCst)) { + if !(self.sck_recv_alive.load(Ordering::SeqCst) && self.sck_send_alive.load(Ordering::SeqCst)) { info!("Starting socket"); let (to_socket, socket_sender_rx) = async_channel::bounded::(10); @@ -89,11 +89,9 @@ impl <'a> CoordState<'a> { if let Err(e) = self.to_gui.send(GuiUpdate::SocketState(false)).await { error!("Cannot send message to gui thread: {e}"); } - } else { - if let Err(e) = self.to_gui.send(GuiUpdate::SocketState(true)).await { - error!("Cannot send message to gui thread: {e}"); - self.close().await; - } + } else if let Err(e) = self.to_gui.send(GuiUpdate::SocketState(true)).await { + error!("Cannot send message to gui thread: {e}"); + self.close().await; } } diff --git a/src/joystick_loop.rs b/src/joystick_loop.rs index f18a4f1..90e0fe5 100644 --- a/src/joystick_loop.rs +++ b/src/joystick_loop.rs @@ -2,7 +2,7 @@ use crate::coordinator::{ApplicationEvent, MoveEvent}; use async_channel::Sender; use gilrs::{ev::filter::FilterFn, Axis, Button, Event, EventType, Filter, Gilrs, GilrsBuilder}; -use log::{debug, info, warn}; +use log::{info, warn}; use std::{ panic::{self, AssertUnwindSafe}, sync::{atomic::AtomicBool, Arc},