fix: wait for the peer to close after a login error or privacy-mode notice

A LoginResponse error is often the last message before the connection
closes (login scope change, switch-sides rejection, ID whitelist, privacy
mode on, offline). The PrvOnByOther notice is likewise sent right before
on_close. Over WebRTC or KCP, dropping the stream right after these sends
can discard them, so they now take the same bounded delivery wait as
CloseReason.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq
This commit is contained in:
RustDeskandClaude Opus 5.5 committed 2026-11-29 22:42:44 +08:00
1 parent 0de25e4fd4
commit 24fff979e1
1 file changed
+3
+3
View File
@@ -1206,6 +1206,7 @@ impl Connection<'_> {
back_notification::PrivacyModeState::PrvOnByOther,
String::new(),
)).await;
conn.sent_close_reason = true;
conn.on_close("privacy mode", false).await;
break;
}
@@ -2491,6 +2492,8 @@ impl Connection<'_> {
self.lr.trusted_device_v2_supported && self.trusted_device.is_some();
msg_out.set_login_response(res);
self.send(msg_out).await;
// Many callers close right after this, so the error needs the same delivery wait.
self.sent_close_reason = true;
}
#[inline]