Граф коммитов

10 Коммитов

Автор SHA1 Сообщение Дата
Ben Harris a3aca31b55 Fix a stupid sign bug in run_timers() that broke Windows Plink (and
should really have broken everything else too).

[originally from svn r9674]
2012-09-19 22:12:00 +00:00
Ben Harris d5836982e2 Two related changes to timing code:
First, make absolute times unsigned.  This means that it's safe to 
depend on their overflow behaviour (which is undefined for signed 
integers).  This requires a little extra care in handling comparisons, 
but I think I've correctly adjusted them all.

Second, functions registered with schedule_timer() are guaranteed to be 
called with precisely the time that was returned by schedule_timer().  
Thus, it's only necessary to check these values for equality rather than 
doing risky range checks, so do that.

The timing code still does lots that's undefined, unnecessary, or just
wrong, but this is a good start.

[originally from svn r9667]
2012-09-18 21:42:48 +00:00
Simon Tatham 03ebc74b9f Partially revert r9636. It is true that we can directly return the
result of memcmp, but untrue that we can do so _unconditionally_: if
memcmp returns zero, we still need to fall through to the next
comparison.

[originally from svn r9637]
[r9636 == 538090ede4]
2012-08-28 17:41:10 +00:00
Ben Harris 538090ede4 Clang, like LCC, objects to using '<' and '>' on function pointers.
I'm not entirely sure that using memcmp() is any more defined by the C
standard, but at least Clang doesn't complain about it.  While I'm
here, tree234 doesn't require that comparison functions return
precisely +1 or -1, so we can use the return value of memcmp()
directly.

[originally from svn r9636]
2012-08-27 23:16:49 +00:00
Simon Tatham aba05b7180 Patch from Robert de Bath to substantially simplify timing.c.
The previous platform-dependent ifdefs, switching between a system
which tried to cope with spurious callbacks (which I'd observed on
Windows) and one which tried to cope with system clock jumps (which
can happen on Unix, if you use gettimeofday) have been completely
removed, and replaced with a much simpler approach which just copes
with system clock jumps by triggering any timers immediately.

None of the resulting effects should be catastrophic (the worst thing
might be the waste of CPU in a spurious rekey, but as long as the
system clock isn't jumping around _all_ the time that's hardly
critical) and in any case the Unix port has had a long-standing oddity
involving occasional lockups if pterm or PuTTY runs for too long,
which hopefully this should replace with a much less bad failure mode.
And the code is much simpler, which is not to be sneezed at.

[originally from svn r9528]
2012-05-13 15:59:26 +00:00
Jacob Nevins af8fd0fea6 Revert r8847, which was bilge; I can't magically change the order of a tree
just by giving a different sorting function to find234().

[originally from svn r8849]
[r8847 == 7f7877e9a5]
2010-01-17 23:53:29 +00:00
Jacob Nevins 7f7877e9a5 Change expiry of timers when their contexts go away from lazy to eager.
Intended to be of benefit to derived code making many connections from a single
process.

[originally from svn r8847]
2010-01-17 16:22:35 +00:00
Simon Tatham d0beed9aba Render timing.c robust in the face of strangeness. The strangenesses
in question vary per OS: on Windows the problem is that WM_TIMER
sometimes goes off too early, so that GetTickCount() is right and
the callback time is wrong, whereas on Unix the problem is that my
GETTICKCOUNT implementation comes from the system clock which means
it can change suddenly and non-monotonically if the sysadmin is
messing about (meaning that the timing of callbacks from GTK or
select timeouts is _more_ likely to be right than GETTICKCOUNT).
This checkin provides band-aid workarounds for both problems, which
aren't pretty but ought to at least prevent catastrophic assertion
failure.

[originally from svn r5556]
2005-03-28 17:48:24 +00:00
Simon Tatham 68d88605ae Work around lcc's annoying (but, even more annoyingly, legitimate)
refusal to allow comparison of function pointers. Unfortunately this
still doesn't cause PuTTY to compile on my lcc installation, because
the GetCharacterPlacement stuff in exact_textout() is missing from
its header files. This may have been fixed in a future version (I'm
using lcc-win32 version 3.8 from December 2003), but I haven't
checked.

[originally from svn r5527]
2005-03-19 16:34:58 +00:00
Simon Tatham 7ecf13564a New timing infrastructure. There's a new function schedule_timer()
which pretty much any module can call to request a call-back in the
future. So terminal.c can do its own handling of blinking, visual
bells and deferred screen updates, without having to rely on
term_update() being called 50 times a second (fixes: pterm-timer);
and ssh.c and telnet.c both invoke a new module pinger.c which takes
care of sending keepalives, so they get sent uniformly in all front
ends (fixes: plink-keepalives, unix-keepalives).

[originally from svn r4906]
[this svn revision also touched putty-wishlist]
2004-11-27 13:20:21 +00:00