Hi Xperts.

Some days ago I posted a phenomen about "too many keepalive retransmissions, declaring 
session dead"
problems when using X via xdmcp. I investigated some time to solve the problem. That's 
what what I got:

Using ethereal to view what happens, I saw that i.e. at 4 April, 08:00:47 the client 
is sending many keepalive 
packets in a very short distance of time, before claiming that the session is dead.

Looking at the sources (xdmcp.c), I found that closing sessions happens every 48-49 
days, depending on the size of
the variable "keepaliveDormancy". Using CARD32 as variable type for "timeOutTime" 
while depending on
the system time (see GetTimeInMillis()) will overflow each 2^32 ms (about 49 days).

The function "XdmcpWakeupHandler" in xdmcp.c is not working in a correct way when the 
overflow happens.
As a workaround I added an if clause to wait for GetTimeInMillis to overflow, too.

--- xdmcp.c     Tue May  1 09:53:47 2001
+++ /root/xdmcp.c.new       Sun Apr  7 15:17:57 2002
@@ -723,6 +723,7 @@
 {
     fd_set* LastSelectMask = (fd_set*)pReadmask;
     fd_set   devicesReadable;
+    CARD32   savedTimeOutTime;

     if (state == XDM_OFF)
        return;
@@ -744,8 +745,11 @@
        if (XFD_ANYSET(&AllClients) && state == XDM_RUN_SESSION)
            timeOutTime = GetTimeInMillis() +  keepaliveDormancy * 1000;
     }
-    else if (timeOutTime && GetTimeInMillis() >= timeOutTime)
-    {
+    else if (timeOutTime && (savedTimeOutTime= GetTimeInMillis()) >= timeOutTime)
+    {
+       if ((savedTimeOutTime - timeOutTime) > XDM_MAX_DORMANCY)
+               return;
+
        if (state == XDM_RUN_SESSION)
        {
            state = XDM_KEEPALIVE;


The problem seems to be away for now. If there's a clean solution, please let me know.

Thanks,
-Cajus
_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert

Reply via email to