added priority to socket messages
This commit is contained in:
parent
0a99879449
commit
6f4430a725
3 changed files with 4 additions and 4 deletions
|
@ -23,7 +23,7 @@ async fn socket_listen(
|
||||||
while let Some(msg) = reader.next().await {
|
while let Some(msg) = reader.next().await {
|
||||||
match msg {
|
match msg {
|
||||||
Ok(val) => {
|
Ok(val) => {
|
||||||
if let Err(e) = mec.send(ApplicationEvent::SocketMessage(val)).await {
|
if let Err(e) = mec.send(ApplicationEvent::SocketMessage(val, 0)).await {
|
||||||
error!("There was an error sending to Main Event Channel, closing socket recv thread: {e}");
|
error!("There was an error sending to Main Event Channel, closing socket recv thread: {e}");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ pub struct MoveEvent {
|
||||||
|
|
||||||
pub enum ApplicationEvent {
|
pub enum ApplicationEvent {
|
||||||
StartSocket(String),
|
StartSocket(String),
|
||||||
SocketMessage(Message),
|
SocketMessage(Message, u32),
|
||||||
MoveEvent(MoveEvent),
|
MoveEvent(MoveEvent),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ pub async fn start_coordinator(
|
||||||
ApplicationEvent::StartSocket(conn) => {
|
ApplicationEvent::StartSocket(conn) => {
|
||||||
state.socket_start(conn).await;
|
state.socket_start(conn).await;
|
||||||
}
|
}
|
||||||
ApplicationEvent::SocketMessage(socket_message) => {
|
ApplicationEvent::SocketMessage(socket_message, priority) => {
|
||||||
if let Err(e) = state.to_gui.send(GuiUpdate::SocketState(true)).await {
|
if let Err(e) = state.to_gui.send(GuiUpdate::SocketState(true)).await {
|
||||||
error!("Could not send to gui thread! Closing coordinator: {e}");
|
error!("Could not send to gui thread! Closing coordinator: {e}");
|
||||||
state.close().await;
|
state.close().await;
|
||||||
|
|
|
@ -114,7 +114,7 @@ pub fn build_ui(app: &Application, runtime: Handle) {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
button2.connect_clicked(glib::clone!(@strong to_mec => move |_button| {
|
button2.connect_clicked(glib::clone!(@strong to_mec => move |_button| {
|
||||||
if let Err(e) = to_mec.try_send(ApplicationEvent::SocketMessage(Message::text("U45:L10"))) {
|
if let Err(e) = to_mec.try_send(ApplicationEvent::SocketMessage(Message::text("U45:L10"), 1)) {
|
||||||
panic!("There was an error in connect clicked: {e}");
|
panic!("There was an error in connect clicked: {e}");
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Reference in a new issue