Commit 9f000842 authored by Keith Packard's avatar Keith Packard Committed by Mike Gabriel

os/xdmcp: Just send XDMCP keepalive packets once every three minute

Backported from X.org: commit db1089eafc1c5371fa0030202de588d2e2b4f8e5 Author: Keith Packard <keithp@keithp.com> Date: Mon Sep 21 07:16:17 2015 +0100 os/xdmcp: Just send XDMCP keepalive packets once every three minutes There was a complicated scheme to increase the time between keepalives from 3 minutes up to as much as 24 hours in an attempt to reduce network traffic from idle X terminals. X terminals receiving X traffic, or receiving user input would use the 3 minute value; X terminals without any network traffic would use a longer value. However, this was actually broken -- any activity in the X server, either client requests or user input, would end up resetting the keepalive timeout, so a user mashing on the keyboard would never discover that the XDMCP master had disappeared and have the session terminated, which was precisely the design goal of the XDMCP keepalive mechanism. Instead of attempting to fix this, accept the cost of a pair of XDMCP packets once every three minutes and just perform keepalives regularly. This will also make reworking the block and wakeup handler APIs to eliminate select masks easier. Reviewed-by: 's avatarAdam Jackson <ajax@redhat.com> Signed-off-by: 's avatarKeith Packard <keithp@keithp.com> Backported-to-NX-by: 's avatarMike Gabriel <mike.gabriel@das-netzwerkteam.de>
parent 6ac805ab
......@@ -88,8 +88,6 @@ static int req_socklen;
static CARD32 SessionID;
static CARD32 timeOutTime;
static int timeOutRtx;
static CARD32 defaultKeepaliveDormancy = XDM_DEF_DORMANCY;
static CARD32 keepaliveDormancy = XDM_DEF_DORMANCY;
static CARD16 DisplayNumber;
static xdmcp_states XDM_INIT_STATE = XDM_OFF;
#ifdef HASXDMAUTH
......@@ -643,6 +641,7 @@ XdmcpOpenDisplay(int sock)
if (state != XDM_AWAIT_MANAGE_RESPONSE)
return;
state = XDM_RUN_SESSION;
timeOutTime = GetTimeInMillis() + XDM_DEF_DORMANCY * 1000;
sessionSocket = sock;
}
......@@ -706,7 +705,6 @@ XdmcpWakeupHandler(
void * pReadmask)
{
fd_set* LastSelectMask = (fd_set*)pReadmask;
fd_set devicesReadable;
#ifdef NX_TRANS_SOCKET
......@@ -731,16 +729,6 @@ XdmcpWakeupHandler(
FD_CLR(xdmcpSocket6, LastSelectMask);
}
#endif
XFD_ANDSET(&devicesReadable, LastSelectMask, &EnabledDevices);
if (XFD_ANYSET(&devicesReadable))
{
if (state == XDM_AWAIT_USER_INPUT)
restart();
else if (state == XDM_RUN_SESSION)
keepaliveDormancy = defaultKeepaliveDormancy;
}
if (XFD_ANYSET(&AllClients) && state == XDM_RUN_SESSION)
timeOutTime = GetTimeInMillis() + keepaliveDormancy * 1000;
}
else if (timeOutTime && (int) (GetTimeInMillis() - timeOutTime) >= 0)
{
......@@ -1428,16 +1416,8 @@ recv_alive_msg (unsigned length)
{
if (SessionRunning && AliveSessionID == SessionID)
{
/* backoff dormancy period */
state = XDM_RUN_SESSION;
if ((GetTimeInMillis() - lastDeviceEventTime.milliseconds) >
keepaliveDormancy * 1000)
{
keepaliveDormancy <<= 1;
if (keepaliveDormancy > XDM_MAX_DORMANCY)
keepaliveDormancy = XDM_MAX_DORMANCY;
}
timeOutTime = GetTimeInMillis() + keepaliveDormancy * 1000;
timeOutTime = GetTimeInMillis() + XDM_DEF_DORMANCY * 1000;
}
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment