mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-09-18 18:31:02 +03:00
fix(linux): a session logout should hand the peer to the login screen (#15905)
* fix(linux): a session logout should hand the peer to the login screen Logging out closes every window in the session, the connection manager's included, and its close handler kicks every peer with the reason a person gets when they disconnect one by hand. That reason is the one thing the client never retries on, so the remote session dies on a frozen frame instead of reconnecting to the greeter that is already there. The close carries nothing to tell the two apart: measured on KDE, the CM receives no signal and logind still reports the session active at that instant, and the server is killed within a few hundred ms either way, so neither a state check nor a grace period can decide it. What is distinguishable is the ACTION: disconnecting a peer is not the same event as this window going away. So the window-close path now says so, and the server ends the session without poisoning the retry; the Disconnect button and the app's own close control keep kicking exactly as before. Linux only, since that is where a logout closes the window. Verified on plasma/sddm with a client attached: a logout now reconnects to the greeter with no dialog, while closing the manager window still shows Closed manually by the peer. * fix(linux): close the tunnel too, and keep the web build compiling Three seams the first pass missed. The web bridge is hand written, not generated, so the new call needs its stub there or flutter build web stops compiling - and that job is disabled in CI, so it would have gone green. try_port_forward_loop is a second consumer of the same channel and only knew Close, so a forwarded tunnel outlived the window it was supposed to die with. And the variant had landed inside the DRM section, whose comment says everything below it is drm-gated.
This commit is contained in:
@@ -642,6 +642,18 @@ impl Connection {
|
||||
conn.on_close("connection manager", true).await;
|
||||
break;
|
||||
}
|
||||
// The connection manager's window went away rather than a person
|
||||
// disconnecting this peer. End the session exactly as above, but do not
|
||||
// send the manual close reason: it is the one thing that stops the peer
|
||||
// from retrying, and on a logout the retry is the whole point - it is
|
||||
// what puts the peer back on the login screen a moment later.
|
||||
#[cfg(target_os = "linux")]
|
||||
ipc::Data::CmWindowClosed => {
|
||||
conn.chat_unanswered = false; // seen
|
||||
conn.file_transferred = false; //seen
|
||||
conn.on_close("connection manager window closed", true).await;
|
||||
break;
|
||||
}
|
||||
ipc::Data::CmErr(e) => {
|
||||
if e != "expected" {
|
||||
// cm closed before connection
|
||||
@@ -1201,6 +1213,13 @@ impl Connection {
|
||||
ipc::Data::Close => {
|
||||
bail!("Close requested from connection manager");
|
||||
}
|
||||
// Same end as above: a tunnel must not outlive the window either.
|
||||
// Only the reason differs, and a port forward carries none - the
|
||||
// peer sees the tunnel drop and decides for itself.
|
||||
#[cfg(target_os = "linux")]
|
||||
ipc::Data::CmWindowClosed => {
|
||||
bail!("Connection manager window closed");
|
||||
}
|
||||
ipc::Data::CmErr(e) => {
|
||||
log::error!("Connection manager error: {e}");
|
||||
bail!("{e}");
|
||||
|
||||
Reference in New Issue
Block a user