summaryrefslogtreecommitdiff
path: root/source3/lib/events.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-12-22 14:52:50 -0800
committerJeremy Allison <jra@samba.org>2010-12-23 01:08:11 +0100
commit30d29e64cb5e0f1360ff47dd6d074d25fa86e5fd (patch)
tree3c3d56a56b041ea869c4e750b59641e9f3495059 /source3/lib/events.c
parent03b8b8e19952c40eb3eb22e16e7fbae4073b7b4b (diff)
downloadsamba-30d29e64cb5e0f1360ff47dd6d074d25fa86e5fd.tar.gz
samba-30d29e64cb5e0f1360ff47dd6d074d25fa86e5fd.tar.bz2
samba-30d29e64cb5e0f1360ff47dd6d074d25fa86e5fd.zip
All calls to event_add_to_select_args() call GetTimeOfDay() and
pass this in as the &now parameter. Push this call inside of event_add_to_select_args() to the correct point so it doesn't get called unless needed. Jeremy. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Thu Dec 23 01:08:11 CET 2010 on sn-devel-104
Diffstat (limited to 'source3/lib/events.c')
-rw-r--r--source3/lib/events.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/source3/lib/events.c b/source3/lib/events.c
index 0e127f02dc..d987072884 100644
--- a/source3/lib/events.c
+++ b/source3/lib/events.c
@@ -27,10 +27,10 @@
*/
bool event_add_to_select_args(struct tevent_context *ev,
- const struct timeval *now,
fd_set *read_fds, fd_set *write_fds,
struct timeval *timeout, int *maxfd)
{
+ struct timeval now;
struct tevent_fd *fde;
struct timeval diff;
bool ret = false;
@@ -60,7 +60,8 @@ bool event_add_to_select_args(struct tevent_context *ev,
return ret;
}
- diff = timeval_until(now, &ev->timer_events->next_event);
+ now = timeval_current();
+ diff = timeval_until(&now, &ev->timer_events->next_event);
*timeout = timeval_min(timeout, &diff);
return true;
@@ -167,7 +168,7 @@ struct timeval *get_timed_events_timeout(struct tevent_context *ev,
static int s3_event_loop_once(struct tevent_context *ev, const char *location)
{
- struct timeval now, to;
+ struct timeval to;
fd_set r_fds, w_fds;
int maxfd = 0;
int ret = 0;
@@ -182,9 +183,7 @@ static int s3_event_loop_once(struct tevent_context *ev, const char *location)
return 0;
}
- GetTimeOfDay(&now);
-
- if (!event_add_to_select_args(ev, &now, &r_fds, &w_fds, &to, &maxfd)) {
+ if (!event_add_to_select_args(ev, &r_fds, &w_fds, &to, &maxfd)) {
return -1;
}