xserver: Branch 'master' - 2 commits

Adam Jackson ajax at kemper.freedesktop.org
Mon Sep 21 12:04:48 PDT 2015


 os/xdmcp.c |   32 ++------------------------------
 1 file changed, 2 insertions(+), 30 deletions(-)

New commits:
commit db1089eafc1c5371fa0030202de588d2e2b4f8e5
Author: Keith Packard <keithp at 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: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/os/xdmcp.c b/os/xdmcp.c
index b1ee5d2..7939b41 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -84,8 +84,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;
 
@@ -632,6 +630,7 @@ XdmcpOpenDisplay(int sock)
     if (state != XDM_AWAIT_MANAGE_RESPONSE)
         return;
     state = XDM_RUN_SESSION;
+    timeOutTime = GetTimeInMillis() + XDM_DEF_DORMANCY * 1000;
     sessionSocket = sock;
 }
 
@@ -689,7 +688,6 @@ XdmcpWakeupHandler(void *data,        /* unused */
                    int i, void *pReadmask)
 {
     fd_set *last_select_mask = (fd_set *) pReadmask;
-    fd_set devicesReadable;
 
     if (state == XDM_OFF)
         return;
@@ -704,13 +702,6 @@ XdmcpWakeupHandler(void *data,        /* unused */
             FD_CLR(xdmcpSocket6, last_select_mask);
         }
 #endif
-        XFD_ANDSET(&devicesReadable, last_select_mask, &EnabledDevices);
-        if (XFD_ANYSET(&devicesReadable)) {
-            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) {
         if (state == XDM_RUN_SESSION) {
@@ -1399,15 +1390,8 @@ recv_alive_msg(unsigned length)
     if (XdmcpReadCARD8(&buffer, &SessionRunning) &&
         XdmcpReadCARD32(&buffer, &AliveSessionID)) {
         if (SessionRunning && AliveSessionID == SessionID) {
-            /* backoff dormancy period */
             state = XDM_RUN_SESSION;
-            if ((GetTimeInMillis() - LastEventTime(XIAllDevices).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 {
             XdmcpDeadSession("Alive response indicates session dead");
commit a3a40291330bad10401fe2bcdbc097ce742b026a
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Sep 21 07:16:16 2015 +0100

    os/xdmcp: Remove dead 'restart' code
    
    The X server used to wait for the user to hit a key or move the mouse
    before restarting the session after a keepalive failure. This,
    presumably, was to avoid having the X server continuously spew XDMCP
    protocol on the network while the XDM server was dead.
    
    Switching into this state was removed from the server some time before
    XFree86 4.3.99.16, so the remaining bits of code have been dead for
    over a decade, and no-one ever noticed.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/os/xdmcp.c b/os/xdmcp.c
index b265db3..b1ee5d2 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -199,8 +199,6 @@ static void send_packet(void);
 
 static void timeout(void);
 
-static void restart(void);
-
 static void XdmcpBlockHandler(void              *data ,
                               struct timeval    **wt,
                               void              *LastSelectMask);
@@ -708,9 +706,7 @@ XdmcpWakeupHandler(void *data,        /* unused */
 #endif
         XFD_ANDSET(&devicesReadable, last_select_mask, &EnabledDevices);
         if (XFD_ANYSET(&devicesReadable)) {
-            if (state == XDM_AWAIT_USER_INPUT)
-                restart();
-            else if (state == XDM_RUN_SESSION)
+            if (state == XDM_RUN_SESSION)
                 keepaliveDormancy = defaultKeepaliveDormancy;
         }
         if (XFD_ANYSET(&AllClients) && state == XDM_RUN_SESSION)
@@ -936,14 +932,6 @@ timeout(void)
     send_packet();
 }
 
-static void
-restart(void)
-{
-    state = XDM_INIT_STATE;
-    timeOutRtx = 0;
-    send_packet();
-}
-
 static int
 XdmcpCheckAuthentication(ARRAY8Ptr Name, ARRAY8Ptr Data, int packet_type)
 {


More information about the xorg-commit mailing list