review: cover Terminal in the displacement test, correct the ipc comment

Terminal is a kind the rule accepts and the test did not exercise. It stays in
the main select loop, so nothing but the assertion was missing.

`Displaced` ends one connection, not the session - the session is precisely
what continues, on the connection that replaced it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019aokqJuhjvB3kijXtAg5Ns
This commit is contained in:
rustdesk
2026-09-09 08:03:30 +08:00
parent 070085a001
commit 0312eb9cb5
2 changed files with 7 additions and 4 deletions

View File

@@ -355,9 +355,10 @@ pub enum Data {
MouseMoveTime(i64),
Authorize,
Close,
// A newer authorized connection has taken this one's place. Ends the session like `Close`
// but sends the peer nothing: the peer that owned this one has already moved on, and the
// link it would be sent over is the very one that stopped working.
// A newer authorized connection has taken this one's place. Ends the superseded connection
// like `Close` - the session itself continues on the newer one - and sends the peer nothing:
// the peer has already moved on, and the link it would be sent over is the very one that
// stopped working.
Displaced,
#[cfg(windows)]
SAS,

View File

@@ -7635,12 +7635,13 @@ mod test {
let mine = key(7, "peer");
// Every kind displaces its own: a stale remote control or camera view keeps the capture
// loop waiting on it, and a stale transfer or tunnel holds its own resources.
// loop waiting on it, and a stale transfer, tunnel or terminal holds its own resources.
for kind in [
AuthConnType::Remote,
AuthConnType::ViewCamera,
AuthConnType::FileTransfer,
AuthConnType::PortForward,
AuthConnType::Terminal,
] {
assert!(
AuthedConnID::is_displaced(&conn(1, kind, mine.clone()), 2, kind, &mine),
@@ -7661,6 +7662,7 @@ mod test {
AuthConnType::FileTransfer,
AuthConnType::PortForward,
AuthConnType::ViewCamera,
AuthConnType::Terminal,
] {
assert!(
!AuthedConnID::is_displaced(