From 048f8dba141c2f9898aad67e09925f03394a946e Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 20 Jan 2009 04:14:20 +0100 Subject: s3: always call run_events() before and after sys_select() And always setup the fd events. metze --- source3/smbd/process.c | 10 ++++------ source3/smbd/server.c | 12 ++++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 44cacfafdd..7847505f7c 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -818,13 +818,11 @@ static NTSTATUS smbd_server_connection_loop_once(struct smbd_server_connection * &r_fds, &w_fds, &to, &maxfd); } - if (timeval_is_zero(&to)) { - /* Process a timed event now... */ - if (run_events(smbd_event_context(), 0, NULL, NULL)) { - return NT_STATUS_RETRY; - } + /* Process a signal and timed events now... */ + if (run_events(smbd_event_context(), 0, NULL, NULL)) { + return NT_STATUS_RETRY; } - + { int sav; START_PROFILE(smbd_idle); diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 42c37f2056..163d0b81be 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -602,6 +602,10 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_ } } + if (run_events(smbd_event_context(), 0, NULL, NULL)) { + continue; + } + idle_timeout = timeval_zero(); memcpy((char *)&r_fds, (char *)&listen_set, @@ -623,6 +627,10 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_ timeval_is_zero(&idle_timeout) ? NULL : &idle_timeout); + if (run_events(smbd_event_context(), num, &r_fds, &w_fds)) { + continue; + } + if (num == -1 && errno == EINTR) { if (got_sig_term) { exit_server_cleanly(NULL); @@ -653,10 +661,6 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_ --num; } - if (run_events(smbd_event_context(), num, &r_fds, &w_fds)) { - continue; - } - /* check if we need to reload services */ check_reload(time(NULL)); -- cgit