code cleanup
This commit is contained in:
parent
cf094dd746
commit
848bdca4ac
2 changed files with 5 additions and 7 deletions
|
@ -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::<Message>(10);
|
||||
|
@ -89,13 +89,11 @@ 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 {
|
||||
} else if let Err(e) = self.to_gui.send(GuiUpdate::SocketState(true)).await {
|
||||
error!("Cannot send message to gui thread: {e}");
|
||||
self.close().await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn close(&mut self) {
|
||||
info!("closing coord state");
|
||||
|
|
|
@ -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},
|
||||
|
|
Loading…
Reference in a new issue