fix: wait for the controlled side to close after a manual disconnect over WebRTC

Data::Close sent CloseReason and dropped the stream at once. Over WebRTC
that can discard the queued reason, so the controlled side logs "Reset by
the peer", skips check_remove_session and keeps the session reusable
without a password for SESSION_TIMEOUT. Wait up to one second for the
controlled side to close, as the controlled side now does.

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-30 14:35:49 +08:00
1 parent f51a0115ef
commit e401af41a1
1 file changed
+9
+9
View File
@@ -758,6 +758,15 @@ impl<T: InvokeUiSession> Remote<T> {
match data {
Data::Close => {
self.send_close_reason(peer, "").await;
if peer.is_webrtc() {
// Dropping the stream can discard the queued reason, and then the controlled
// side keeps this session for a password-free reconnect. It closes once it
// has read the reason.
let _ = tokio::time::timeout(Duration::from_secs(1), async {
while let Some(Ok(_)) = peer.next().await {}
})
.await;
}
return false;
}
Data::Login((os_username, os_password, password, remember)) => {