r23272: Fix main event loop - reviewed by Volker.
[sfrench/samba-autobuild/.git] / source / smbd / server.c
index 8aa4e848a84a2b2b1e994d3d5841858429e8200e..e95f3cf4a2b803c8a30fd5c1a77cb0d91b32a754 100644 (file)
@@ -418,8 +418,6 @@ static BOOL open_sockets_smbd(enum smb_server_mode server_mode, const char *smb_
                                 timeval_is_zero(&idle_timeout) ?
                                 NULL : &idle_timeout);
                
-               run_events(smbd_event_context(), num, &r_fds, &w_fds);
-
                if (num == -1 && errno == EINTR) {
                        if (got_sig_term) {
                                exit_server_cleanly(NULL);
@@ -436,6 +434,10 @@ static BOOL open_sockets_smbd(enum smb_server_mode server_mode, const char *smb_
                        continue;
                }
 
+               if (run_events(smbd_event_context(), num, &r_fds, &w_fds)) {
+                       continue;
+               }
+
 #if 0
                Deactivated for now, this needs to become a timed event
                vl