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) {
|
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");
|
info!("Starting socket");
|
||||||
let (to_socket, socket_sender_rx) = async_channel::bounded::<Message>(10);
|
let (to_socket, socket_sender_rx) = async_channel::bounded::<Message>(10);
|
||||||
|
@ -89,11 +89,9 @@ impl <'a> CoordState<'a> {
|
||||||
if let Err(e) = self.to_gui.send(GuiUpdate::SocketState(false)).await {
|
if let Err(e) = self.to_gui.send(GuiUpdate::SocketState(false)).await {
|
||||||
error!("Cannot send message to gui thread: {e}");
|
error!("Cannot send message to gui thread: {e}");
|
||||||
}
|
}
|
||||||
} else {
|
} else if let Err(e) = self.to_gui.send(GuiUpdate::SocketState(true)).await {
|
||||||
if let Err(e) = self.to_gui.send(GuiUpdate::SocketState(true)).await {
|
error!("Cannot send message to gui thread: {e}");
|
||||||
error!("Cannot send message to gui thread: {e}");
|
self.close().await;
|
||||||
self.close().await;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ use crate::coordinator::{ApplicationEvent, MoveEvent};
|
||||||
|
|
||||||
use async_channel::Sender;
|
use async_channel::Sender;
|
||||||
use gilrs::{ev::filter::FilterFn, Axis, Button, Event, EventType, Filter, Gilrs, GilrsBuilder};
|
use gilrs::{ev::filter::FilterFn, Axis, Button, Event, EventType, Filter, Gilrs, GilrsBuilder};
|
||||||
use log::{debug, info, warn};
|
use log::{info, warn};
|
||||||
use std::{
|
use std::{
|
||||||
panic::{self, AssertUnwindSafe},
|
panic::{self, AssertUnwindSafe},
|
||||||
sync::{atomic::AtomicBool, Arc},
|
sync::{atomic::AtomicBool, Arc},
|
||||||
|
|
Loading…
Reference in a new issue