diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-02-02 10:24:47 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:09:28 -0500 |
commit | 96f02f7403a94e0b674e57cfd50f91cf763c7c5c (patch) | |
tree | 79f5b8523f1848eba67a96a8d89e574d0408db17 /source4 | |
parent | 578b6e5567db5c9378c5d9f175ba9987d8a5e1f9 (diff) | |
download | samba-96f02f7403a94e0b674e57cfd50f91cf763c7c5c.tar.gz samba-96f02f7403a94e0b674e57cfd50f91cf763c7c5c.tar.bz2 samba-96f02f7403a94e0b674e57cfd50f91cf763c7c5c.zip |
r5170: fixed a bug handling events that have already timed out - they were
being treated as events that never time out, so they happened on the
next other event
(This used to be commit 2eefe4f8dea4a9060f229417777435133c684a0c)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/events.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/source4/lib/events.c b/source4/lib/events.c index 166cbe4509..ebfa164885 100644 --- a/source4/lib/events.c +++ b/source4/lib/events.c @@ -223,7 +223,7 @@ int event_loop_once(struct event_context *ev) struct loop_event *le; struct timed_event *te, *te_next; int selrtn; - struct timeval tval, t; + struct timeval tval, t, *tvalp=NULL; uint32_t destruction_count = ev->destruction_count; t = timeval_current(); @@ -264,13 +264,13 @@ int event_loop_once(struct event_context *ev) talloc_free(te); continue; } - tv = timeval_diff(&te->next_event, &t); - if (timeval_is_zero(&tval)) { + if (tvalp == NULL) { tval = tv; } else { tval = timeval_min(&tv, &tval); } + tvalp = &tval; } /* only do a select() if there're fd_events @@ -290,11 +290,7 @@ int event_loop_once(struct event_context *ev) * sys_select() with something in the events * structure - for now just use select() */ - if (timeval_is_zero(&tval)) { - selrtn = select(ev->maxfd+1, &r_fds, &w_fds, NULL, NULL); - } else { - selrtn = select(ev->maxfd+1, &r_fds, &w_fds, NULL, &tval); - } + selrtn = select(ev->maxfd+1, &r_fds, &w_fds, NULL, tvalp); t = timeval_current(); |