summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-09-06 21:43:31 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:43:57 -0500
commitccdd921e61c95e8e2d1764a74603c863ca2867ba (patch)
tree12b556fdfec9a44d1af939dd22603d113659012e /source3/lib
parent012c9e9cf9db9147cd95e1abb0f8db0548e0a9d9 (diff)
downloadsamba-ccdd921e61c95e8e2d1764a74603c863ca2867ba.tar.gz
samba-ccdd921e61c95e8e2d1764a74603c863ca2867ba.tar.bz2
samba-ccdd921e61c95e8e2d1764a74603c863ca2867ba.zip
r18191: Fix the online/offline state handling of winbindd.
Instead of trying to do this in the winbindd_cache entries, add a timed even handler to probe every 5 mins when disconnected. Fix events to run all pending events, rather than only one. Jeremy. (This used to be commit 7bfbe1b4fb9a91c6678035f220bbf0b4f5afdcac)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/events.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/source3/lib/events.c b/source3/lib/events.c
index 6db9930c30..7da44c3466 100644
--- a/source3/lib/events.c
+++ b/source3/lib/events.c
@@ -79,27 +79,24 @@ struct timed_event *add_timed_event(TALLOC_CTX *mem_ctx,
void run_events(void)
{
- struct timeval now;
-
- if (timed_events == NULL) {
- /* No syscall if there are no events */
- DEBUG(11, ("run_events: No events\n"));
- return;
- }
+ /* Run all events that are pending, not just one (as we
+ did previously. */
- GetTimeOfDay(&now);
+ while (timed_events) {
+ struct timeval now;
+ GetTimeOfDay(&now);
- if (timeval_compare(&now, &timed_events->when) < 0) {
- /* Nothing to do yet */
- DEBUG(11, ("run_events: Nothing to do\n"));
- return;
- }
+ if (timeval_compare(&now, &timed_events->when) < 0) {
+ /* Nothing to do yet */
+ DEBUG(11, ("run_events: Nothing to do\n"));
+ return;
+ }
- DEBUG(10, ("Running event \"%s\" %lx\n", timed_events->event_name,
- (unsigned long)timed_events));
+ DEBUG(10, ("Running event \"%s\" %lx\n", timed_events->event_name,
+ (unsigned long)timed_events));
- timed_events->handler(timed_events, &now, timed_events->private_data);
- return;
+ timed_events->handler(timed_events, &now, timed_events->private_data);
+ }
}
struct timeval *get_timed_events_timeout(struct timeval *to_ret)