summaryrefslogtreecommitdiff
path: root/source3/winbindd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/winbindd')
-rw-r--r--source3/winbindd/winbindd.c8
-rw-r--r--source3/winbindd/winbindd_dual.c29
2 files changed, 22 insertions, 15 deletions
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 821812925c..fad27ea224 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -840,12 +840,6 @@ static void process_loop(void)
exit(1);
}
- /* We'll be doing this a lot */
-
- /* Handle messages */
-
- message_dispatch(winbind_messaging_context());
-
run_events(winbind_event_context(), 0, NULL, NULL);
/* refresh the trusted domain cache */
@@ -980,6 +974,8 @@ static void process_loop(void)
no_fds_ready:
+ run_events(winbind_event_context(), selret, &r_fds, &w_fds);
+
#if 0
winbindd_check_cache_size(time(NULL));
#endif
diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c
index 4b57d08b03..c320e96746 100644
--- a/source3/winbindd/winbindd_dual.c
+++ b/source3/winbindd/winbindd_dual.c
@@ -1371,7 +1371,9 @@ static bool fork_domain_child(struct winbindd_child *child)
while (1) {
int ret;
- fd_set read_fds;
+ fd_set r_fds;
+ fd_set w_fds;
+ int maxfd;
struct timeval t;
struct timeval *tp;
struct timeval now;
@@ -1382,7 +1384,10 @@ static bool fork_domain_child(struct winbindd_child *child)
winbind_check_sighup(override_logfile ? NULL :
child->logfilename);
- run_events(winbind_event_context(), 0, NULL, NULL);
+ if (run_events(winbind_event_context(), 0, NULL, NULL)) {
+ TALLOC_FREE(frame);
+ continue;
+ }
GetTimeOfDay(&now);
@@ -1394,20 +1399,26 @@ static bool fork_domain_child(struct winbindd_child *child)
child->domain->startup = False;
}
+ FD_ZERO(&r_fds);
+ FD_ZERO(&w_fds);
+ FD_SET(state.sock, &r_fds);
+ maxfd = state.sock;
+
+ event_add_to_select_args(winbind_event_context(), &now,
+ &r_fds, &w_fds, &t, &maxfd);
tp = get_timed_events_timeout(winbind_event_context(), &t);
if (tp) {
DEBUG(11,("select will use timeout of %u.%u seconds\n",
(unsigned int)tp->tv_sec, (unsigned int)tp->tv_usec ));
}
- /* Handle messages */
-
- message_dispatch(winbind_messaging_context());
+ ret = sys_select(maxfd + 1, &r_fds, &w_fds, NULL, tp);
- FD_ZERO(&read_fds);
- FD_SET(state.sock, &read_fds);
-
- ret = sys_select(state.sock + 1, &read_fds, NULL, NULL, tp);
+ if (run_events(winbind_event_context(), ret, &r_fds, &w_fds)) {
+ /* We got a signal - continue. */
+ TALLOC_FREE(frame);
+ continue;
+ }
if (ret == 0) {
DEBUG(11,("nothing is ready yet, continue\n"));