From 7fca0ba588cc038ba4141a912a67399fe68bfabd Mon Sep 17 00:00:00 2001 From: 21pages Date: Wed, 28 Feb 2024 00:11:02 +0800 Subject: [PATCH] fix rdp not work, caused by test_delay_timer (#7274) * fix rdp not work, caused by test_delay_timer Signed-off-by: 21pages * Update connection.rs --------- Signed-off-by: 21pages Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com> --- src/server/connection.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/server/connection.rs b/src/server/connection.rs index 1e3e8dc42..87cafed21 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -423,7 +423,14 @@ impl Connection { if !conn.block_input { conn.send_permission(Permission::BlockInput, false).await; } - let mut test_delay_timer = crate::rustdesk_interval(time::interval(TEST_DELAY_TIMEOUT)); + // Note: The start parameter of interval_at needs to add TEST_DELAY_TIMEOUT, otherwise windows rdp will be affected. + // This is because controlling's TestDelay messsage comes late and injects to rdp data flow. + // Todo: Controlling side sends a notification message to controlled side before entering port forward loop, https://github.com/rustdesk/rustdesk/blob/50d080d098b22f53e46744fbdd286f2d81d64a4d/src/port_forward.rs#L187 + //, and controller side waits for this notification before entering port forward loop. + let mut test_delay_timer = crate::rustdesk_interval(time::interval_at( + Instant::now() + TEST_DELAY_TIMEOUT, + TEST_DELAY_TIMEOUT, + )); let mut last_recv_time = Instant::now(); conn.stream.set_send_timeout(