projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Two related changes to timing code:
[u/mdw/putty]
/
windows
/
winsftp.c
diff --git
a/windows/winsftp.c
b/windows/winsftp.c
index
e6b55c1
..
d4c5fa6
100644
(file)
--- a/
windows/winsftp.c
+++ b/
windows/winsftp.c
@@
-486,15
+486,20
@@
extern int select_result(WPARAM, LPARAM);
int do_eventsel_loop(HANDLE other_event)
{
int n, nhandles, nallhandles, netindex, otherindex;
int do_eventsel_loop(HANDLE other_event)
{
int n, nhandles, nallhandles, netindex, otherindex;
- long next, ticks;
+ unsigned long next, then;
+ long ticks;
HANDLE *handles;
SOCKET *sklist;
int skcount;
HANDLE *handles;
SOCKET *sklist;
int skcount;
- long now = GETTICKCOUNT();
+
unsigned
long now = GETTICKCOUNT();
if (run_timers(now, &next)) {
if (run_timers(now, &next)) {
- ticks = next - GETTICKCOUNT();
- if (ticks < 0) ticks = 0; /* just in case */
+ then = now;
+ now = GETTICKCOUNT();
+ if (now - then > next - then)
+ ticks = 0;
+ else
+ ticks = next - now;
} else {
ticks = INFINITE;
}
} else {
ticks = INFINITE;
}