Fix issue that connection failed dialog keeps popping up if lan device is offline

This commit is contained in:
Noisyfox
2025-10-07 09:57:17 +08:00
parent 4ee98b1807
commit 45bf4a99f1

View File

@@ -1767,10 +1767,10 @@ void GUI_App::init_networking_callbacks()
event.SetString(obj->get_dev_id()); event.SetString(obj->get_dev_id());
GUI::wxGetApp().sidebar().load_ams_list(obj->get_dev_id(), obj); GUI::wxGetApp().sidebar().load_ams_list(obj->get_dev_id(), obj);
} else if (state == ConnectStatus::ConnectStatusFailed) { } else if (state == ConnectStatus::ConnectStatusFailed) {
// Orca: avoid showing same error message multiple times until next connection attempt. // Orca: only update status if same device id
const auto already_disconnected = m_device_manager->selected_machine.empty(); if (m_device_manager->selected_machine != dev_id) return;
m_device_manager->set_selected_machine(""); m_device_manager->set_selected_machine("");
if (!already_disconnected) {
wxString text; wxString text;
if (msg == "5") { if (msg == "5") {
obj->set_access_code(""); obj->set_access_code("");
@@ -1781,7 +1781,6 @@ void GUI_App::init_networking_callbacks()
text = wxString::Format(_L("Connect %s failed! [SN:%s, code=%s]"), from_u8(obj->get_dev_name()), obj->get_dev_id(), msg); text = wxString::Format(_L("Connect %s failed! [SN:%s, code=%s]"), from_u8(obj->get_dev_name()), obj->get_dev_id(), msg);
wxGetApp().show_dialog(text); wxGetApp().show_dialog(text);
} }
}
event.SetInt(-1); event.SetInt(-1);
} else if (state == ConnectStatus::ConnectStatusLost) { } else if (state == ConnectStatus::ConnectStatusLost) {
m_device_manager->set_selected_machine(""); m_device_manager->set_selected_machine("");