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>
This commit is contained in:
Cendio 2018-03-07 10:49:25 +01:00
parent 62ea190c0c
commit 4580492c12
2 changed files with 24 additions and 3 deletions

View File

@ -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

17
xwin.c
View File

@ -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;