I don't see how the original code could go wrong even if time went
backwards, unless there's some combination of signed/unsigned 32/64-bit
time_t/int that produces a weird value.  It would cause a timeout if time
went sufficiently far forwards, but then arguably that would be the correct
behaviour anyway. I'd be interested to know if your change seems to make any
difference.

The deferUpdate timer just uses the X server's standard timer mechanism.
That's harder to modify since it's in the X server code and would need yet
another patch which always introduces the fun possibility of it failing on
different X trees....:-)

Cheers

Tristan

----- Original Message ----- 
From: "Tim Waugh" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 03, 2003 6:09 PM
Subject: 4.0b3: timeout handling


> I think that some of the timeout handling in VNC is quite sensitive to
> having things like NTP running.  I have seen the idle timeout trigger
> after only a few seconds' use, and have also seen the deferUpdate
> timeout completely fail to trigger.
>
> My theory is that NTP is stepping the time back when I've seen this
> happen, and that there are incautious comparisons in the timeout code
> in VNC.
>
> How about making changes like the following?:
>
> --- VNCSConnectionST.cxx.timeout 2003-09-03 18:05:01.000000000 +0100
> +++ VNCSConnectionST.cxx 2003-09-03 18:07:54.000000000 +0100
> @@ -206,7 +206,8 @@
>    if (state() != RFBSTATE_NORMAL && idleTimeout < 15)
>      idleTimeout = 15; // minimum of 15 seconds while authenticating
>    time_t now = time(0);
> -  int timeLeft = lastEventTime + idleTimeout - now;
> +  unsigned int sincelast = now > lastEventTime ? now - lastEventTime : 0;
> +  int timeLeft = idletimeout - sincelast;
>    if (timeLeft <= 0) {
>      close("Idle timeout");
>      return 0;
>
> Tim.
> */
>
> [demime 0.99d.1 removed an attachment of type application/pgp-signature]
> _______________________________________________
> VNC-List mailing list
> [EMAIL PROTECTED]
> To remove yourself from the list visit:
> http://www.realvnc.com/mailman/listinfo/vnc-list
_______________________________________________
VNC-List mailing list
[EMAIL PROTECTED]
To remove yourself from the list visit:
http://www.realvnc.com/mailman/listinfo/vnc-list

Reply via email to