From 68f46d7465da5f2de4bbab646295fbb0b6496c6e Mon Sep 17 00:00:00 2001 From: Varga Marcell <128537619+marci1175@users.noreply.github.com> Date: Sun, 14 Jan 2024 22:28:29 +0100 Subject: [PATCH] thread fix connecting still needs fix --- build_info.matthias_build | 2 +- src/app.rs | 13 ++----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/build_info.matthias_build b/build_info.matthias_build index c0c73274..acda9897 100644 --- a/build_info.matthias_build +++ b/build_info.matthias_build @@ -1 +1 @@ -2024.01.14. 22:22 \ No newline at end of file +2024.01.14. 22:25 \ No newline at end of file diff --git a/src/app.rs b/src/app.rs index 5655bb02..4d7e0fb6 100644 --- a/src/app.rs +++ b/src/app.rs @@ -134,7 +134,7 @@ impl eframe::App for backend::TemplateApp { let sender = self.connection_sender.clone(); - std::thread::spawn(move || { + tokio::spawn(async move { match ClientConnection::connect(format!("http://{}", ip)) { Ok(ok) => { if let Err(err) = sender.send(ok){ @@ -183,15 +183,6 @@ impl eframe::App for backend::TemplateApp { }, } - match self.client_connection.client.is_none() { - true => { - - } - false => { - - } - } - match self.client_connection.state { ConnectionState::Connected => { ui.label(RichText::from("Connected").color(Color32::GREEN)); @@ -293,7 +284,7 @@ impl eframe::App for backend::TemplateApp { //Connection reciver match self.connection_reciver.try_recv() { - Ok(connection) => self.client_connection = connection, + Ok(connection) => {self.client_connection.state = ConnectionState::Connected; self.client_connection = connection}, Err(err) => { //dbg!(err); },