mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-10-20 19:14:39 +08:00
[fix] restore Windows remote control after RDP disconnects
This commit is contained in:
@@ -216,6 +216,10 @@ void GuiRuntime::HandleServerControllerDisconnected(
|
||||
remaining_controller_id = id;
|
||||
}
|
||||
}
|
||||
#if _WIN32
|
||||
windows_rdp_handoff_connected_->store(has_connected_controller,
|
||||
std::memory_order_relaxed);
|
||||
#endif
|
||||
}
|
||||
if (has_connected_controller) {
|
||||
remote_client_id_ = remaining_controller_id;
|
||||
|
||||
@@ -27,6 +27,11 @@ GuiRuntime::GuiRuntime()
|
||||
keyboard_(*this) {}
|
||||
|
||||
GuiRuntime::~GuiRuntime() {
|
||||
#if _WIN32
|
||||
windows_rdp_handoff_allowed_->store(false, std::memory_order_relaxed);
|
||||
windows_rdp_handoff_connected_->store(false, std::memory_order_relaxed);
|
||||
if (windows_service_worker_) windows_service_worker_->Reset();
|
||||
#endif
|
||||
transfers_.Shutdown();
|
||||
WaitForSessionCleanup();
|
||||
}
|
||||
|
||||
@@ -436,6 +436,12 @@ void PeerEventHandler::OnConnectionStatus(ConnectionStatus status,
|
||||
runtime->ApplyPrivacyAdmission(automatic_enable);
|
||||
}
|
||||
runtime->connection_status_[remote_id] = status;
|
||||
#if _WIN32
|
||||
runtime->windows_rdp_handoff_connected_->store(std::any_of(
|
||||
runtime->connection_status_.begin(), runtime->connection_status_.end(),
|
||||
[](const auto& entry) { return entry.second == ConnectionStatus::Connected; }),
|
||||
std::memory_order_relaxed);
|
||||
#endif
|
||||
runtime->devices_.OnControllerConnectionsChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,13 @@ struct PeerState {
|
||||
struct PlatformIntegrationState {
|
||||
#if _WIN32
|
||||
std::unique_ptr<ServiceQueryWorker> windows_service_worker_;
|
||||
// Lifecycle gate for interactive hosts; revoked before shutdown.
|
||||
std::shared_ptr<std::atomic<bool>> windows_rdp_handoff_allowed_ =
|
||||
std::make_shared<std::atomic<bool>>(false);
|
||||
// Transport callbacks revoke this immediately; a stale UI snapshot cannot
|
||||
// authorize a request after the last authenticated controller disconnects.
|
||||
std::shared_ptr<std::atomic<bool>> windows_rdp_handoff_connected_ =
|
||||
std::make_shared<std::atomic<bool>>(false);
|
||||
// Published by the UI, read by transport callbacks without sharing a mutable string.
|
||||
mutable std::mutex windows_input_stage_mutex_;
|
||||
std::string windows_input_stage_;
|
||||
|
||||
Reference in New Issue
Block a user