summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCendio <cendio@pairstation.lkpg.cendio.se>2018-03-07 10:49:25 +0100
committerCendio <cendio@pairstation.lkpg.cendio.se>2018-03-07 10:49:25 +0100
commit4580492c1224f9c5d72f8863e8027563d58494ec (patch)
treef596783194f34ef46607e437928d78d6c94e0b6d
parent62ea190c0c5a99d2f06b02f4d45ad9d63906d897 (diff)
downloadrdesktop-4580492c1224f9c5d72f8863e8027563d58494ec.zip
Prefer online resize over reconnect resizes
We had a case on Windows 2012R2 where any early resizes would be handled by a reconnect rather than an online resize, which led to a bunch of follow-up problems with the session startup. To solve this, we gave the RDPEDISP channel more time to become established. Co-authored-by: Henrik Andersson <hean01@cendio.com> Co-authored-by: Karl Mikaelsson <derfian@cendio.se>
-rw-r--r--rdpedisp.c10
-rw-r--r--xwin.c17
2 files changed, 24 insertions, 3 deletions
diff --git a/rdpedisp.c b/rdpedisp.c
index 43903ae..d1f27b8 100644
--- a/rdpedisp.c
+++ b/rdpedisp.c
@@ -28,6 +28,7 @@
extern int g_dpi;
extern RD_BOOL g_pending_resize_defer;
+extern struct timeval g_pending_resize_defer_timer;
static void rdpedisp_send(STREAM s);
static void rdpedisp_init_packet(STREAM s, uint32 type, uint32 length);
@@ -45,8 +46,15 @@ rdpedisp_process_caps_pdu(STREAM s)
"rdpedisp_process_caps_pdu(), Max supported monitor area (square pixels) is %d",
tmp[0] * tmp[1] * tmp[2]);
- /* Start allowing session resizes */
+ /* When the RDPEDISP channel is established, we allow dynamic
+ session resize straight away by clearing the defer flag and
+ the defer timer. This lets process_pending_resize() start
+ processing pending resizes immediately. We expect that
+ process_pending_resize will prefer RDPEDISP resizes over
+ disconnect/reconnect resizes. */
g_pending_resize_defer = False;
+ g_pending_resize_defer_timer.tv_sec = 0;
+ g_pending_resize_defer_timer.tv_usec = 0;
}
static void
diff --git a/xwin.c b/xwin.c
index 6fa4343..5fcd99d 100644
--- a/xwin.c
+++ b/xwin.c
@@ -3065,9 +3065,22 @@ process_pending_resize ()
/* There is a race problem when using disconnect / reconnect
sequence were one sometimes would be presented with
unexpected login window. Waiting a little bit extra after
- getting the reconnect cookie solves this problem. */
+ getting the reconnect cookie solves this problem.
+
+ In addition to that delay, we also want to wait for
+ RDPEDISP to become available. In scenarios where we can use
+ both online and reconnect-based resizes, we prefer
+ online. Our brief investigation shows that RDPEDISP support
+ is established about 100-300 ms after the login info packet
+ was received. Thus, we want to wait a bit so we can avoid
+ resizes using reconnect. Once RDPEDISP is established, the
+ defer timer is cleared, so there will be no delay before
+ the first resize for servers that support RDPEDISP. Other
+ servers will get the initial resize delayed with 2 seconds.
+ */
+
if (timeval_is_set(&g_pending_resize_defer_timer) &&
- time_difference_in_ms(g_pending_resize_defer_timer, now) >= 100)
+ time_difference_in_ms(g_pending_resize_defer_timer, now) >= 2000)
{
g_pending_resize_defer_timer.tv_sec = g_pending_resize_defer_timer.tv_usec = 0;
g_pending_resize_defer = False;