[fix] prevent sending connection requests to offline devices

This commit is contained in:
dijunkun
2026-03-10 10:53:58 +08:00
parent 263c5eefd3
commit 3e31ba102d

View File

@@ -166,6 +166,14 @@ static int InputTextCallback(ImGuiInputTextCallbackData* data) {
int Render::ConnectTo(const std::string& remote_id, const char* password, int Render::ConnectTo(const std::string& remote_id, const char* password,
bool remember_password) { bool remember_password) {
if (!device_presence_.IsOnline(remote_id)) {
offline_warning_text_ =
localization::device_offline[localization_language_index_];
show_offline_warning_window_ = true;
LOG_WARN("Skip connect to [{}]: device is offline", remote_id);
return -1;
}
LOG_INFO("Connect to [{}]", remote_id); LOG_INFO("Connect to [{}]", remote_id);
focused_remote_id_ = remote_id; focused_remote_id_ = remote_id;