mirror of
https://github.com/samba-team/samba.git
synced 2025-02-25 17:57:42 +03:00
Revert "s3:events: Call all ready fd event handlers on each iteration of the main loop"
This reverts commit 455fccf86b6544cd17a2571c63a88f8aebff3f74. I'll add a more generic fix for this problem. metze
This commit is contained in:
parent
1537f5dab1
commit
19d3779274
@ -30,7 +30,7 @@ bool event_add_to_select_args(struct event_context *event_ctx,
|
||||
fd_set *read_fds, fd_set *write_fds,
|
||||
struct timeval *timeout, int *maxfd);
|
||||
bool run_events(struct event_context *event_ctx,
|
||||
int *selrtn, fd_set *read_fds, fd_set *write_fds);
|
||||
int selrtn, fd_set *read_fds, fd_set *write_fds);
|
||||
struct timeval *get_timed_events_timeout(struct event_context *event_ctx,
|
||||
struct timeval *to_ret);
|
||||
void dump_event_list(struct event_context *event_ctx);
|
||||
|
@ -68,7 +68,7 @@ bool event_add_to_select_args(struct tevent_context *ev,
|
||||
}
|
||||
|
||||
bool run_events(struct tevent_context *ev,
|
||||
int *selrtn, fd_set *read_fds, fd_set *write_fds)
|
||||
int selrtn, fd_set *read_fds, fd_set *write_fds)
|
||||
{
|
||||
struct tevent_fd *fde;
|
||||
struct timeval now;
|
||||
@ -113,7 +113,7 @@ bool run_events(struct tevent_context *ev,
|
||||
return true;
|
||||
}
|
||||
|
||||
if (*selrtn <= 0) {
|
||||
if (selrtn == 0) {
|
||||
/*
|
||||
* No fd ready
|
||||
*/
|
||||
@ -123,16 +123,8 @@ bool run_events(struct tevent_context *ev,
|
||||
for (fde = ev->fd_events; fde; fde = fde->next) {
|
||||
uint16 flags = 0;
|
||||
|
||||
if (FD_ISSET(fde->fd, read_fds)) {
|
||||
flags |= EVENT_FD_READ;
|
||||
FD_CLR(fde->fd, read_fds);
|
||||
(*selrtn)--;
|
||||
}
|
||||
if (FD_ISSET(fde->fd, write_fds)) {
|
||||
flags |= EVENT_FD_WRITE;
|
||||
FD_CLR(fde->fd, write_fds);
|
||||
(*selrtn)--;
|
||||
}
|
||||
if (FD_ISSET(fde->fd, read_fds)) flags |= EVENT_FD_READ;
|
||||
if (FD_ISSET(fde->fd, write_fds)) flags |= EVENT_FD_WRITE;
|
||||
|
||||
if (flags & fde->flags) {
|
||||
fde->handler(ev, fde, flags, fde->private_data);
|
||||
@ -171,7 +163,7 @@ static int s3_event_loop_once(struct tevent_context *ev, const char *location)
|
||||
struct timeval to;
|
||||
fd_set r_fds, w_fds;
|
||||
int maxfd = 0;
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
FD_ZERO(&r_fds);
|
||||
FD_ZERO(&w_fds);
|
||||
@ -179,7 +171,7 @@ static int s3_event_loop_once(struct tevent_context *ev, const char *location)
|
||||
to.tv_sec = 9999; /* Max timeout */
|
||||
to.tv_usec = 0;
|
||||
|
||||
if (run_events(ev, &ret, NULL, NULL)) {
|
||||
if (run_events(ev, 0, NULL, NULL)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -196,7 +188,7 @@ static int s3_event_loop_once(struct tevent_context *ev, const char *location)
|
||||
return -1;
|
||||
}
|
||||
|
||||
run_events(ev, &ret, &r_fds, &w_fds);
|
||||
run_events(ev, ret, &r_fds, &w_fds);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1857,7 +1857,7 @@ bool listen_for_packets(bool run_election)
|
||||
|
||||
fd_set r_fds;
|
||||
fd_set w_fds;
|
||||
int selrtn = 0;
|
||||
int selrtn;
|
||||
struct timeval timeout;
|
||||
#ifndef SYNC_DNS
|
||||
int dns_fd;
|
||||
@ -1884,7 +1884,7 @@ bool listen_for_packets(bool run_election)
|
||||
#endif
|
||||
|
||||
/* Process a signal and timer events now... */
|
||||
if (run_events(nmbd_event_context(), &selrtn, NULL, NULL)) {
|
||||
if (run_events(nmbd_event_context(), 0, NULL, NULL)) {
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -1903,7 +1903,7 @@ bool listen_for_packets(bool run_election)
|
||||
|
||||
selrtn = sys_select(maxfd+1,&r_fds,&w_fds,NULL,&timeout);
|
||||
|
||||
if (run_events(nmbd_event_context(), &selrtn, &r_fds, &w_fds)) {
|
||||
if (run_events(nmbd_event_context(), selrtn, &r_fds, &w_fds)) {
|
||||
return False;
|
||||
}
|
||||
|
||||
|
@ -963,7 +963,7 @@ void smbd_setup_sig_hup_handler(struct tevent_context *ev,
|
||||
static NTSTATUS smbd_server_connection_loop_once(struct smbd_server_connection *conn)
|
||||
{
|
||||
fd_set r_fds, w_fds;
|
||||
int selrtn = 0;
|
||||
int selrtn;
|
||||
struct timeval to;
|
||||
int maxfd = 0;
|
||||
|
||||
@ -986,7 +986,7 @@ static NTSTATUS smbd_server_connection_loop_once(struct smbd_server_connection *
|
||||
&r_fds, &w_fds, &to, &maxfd);
|
||||
|
||||
/* Process a signal and timed events now... */
|
||||
if (run_events(smbd_event_context(), &selrtn, NULL, NULL)) {
|
||||
if (run_events(smbd_event_context(), 0, NULL, NULL)) {
|
||||
return NT_STATUS_RETRY;
|
||||
}
|
||||
|
||||
@ -1003,23 +1003,26 @@ static NTSTATUS smbd_server_connection_loop_once(struct smbd_server_connection *
|
||||
|
||||
/* Check if error */
|
||||
if (selrtn == -1) {
|
||||
if (errno == EINTR)
|
||||
return NT_STATUS_RETRY;
|
||||
else
|
||||
/* Maybe the socket is dead? */
|
||||
return map_nt_error_from_unix(errno);
|
||||
/* something is wrong. Maybe the socket is dead? */
|
||||
return map_nt_error_from_unix(errno);
|
||||
}
|
||||
|
||||
/* Process events until all available fds have been handled.
|
||||
* This allows for fair round-robin handling of all available fds
|
||||
* on each select() wakeup, while still maintaining responsiveness
|
||||
* by re-checking for signal and timed events between the handling
|
||||
* of each ready fd. */
|
||||
do {
|
||||
run_events(smbd_event_context(), &selrtn, &r_fds, &w_fds);
|
||||
} while (selrtn > 0);
|
||||
if ((conn->smb1.echo_handler.trusted_fd != -1)
|
||||
&& FD_ISSET(conn->sock, &r_fds)
|
||||
&& FD_ISSET(conn->smb1.echo_handler.trusted_fd, &r_fds)) {
|
||||
/*
|
||||
* Prefer to read pending requests from the echo handler. To
|
||||
* quote Jeremy (da70f8ab1): This is a hack of monstrous
|
||||
* proportions...
|
||||
*/
|
||||
FD_CLR(conn->sock, &r_fds);
|
||||
}
|
||||
|
||||
/* Processed all fds or timed out */
|
||||
if (run_events(smbd_event_context(), selrtn, &r_fds, &w_fds)) {
|
||||
return NT_STATUS_RETRY;
|
||||
}
|
||||
|
||||
/* Did we timeout ? */
|
||||
if (selrtn == 0) {
|
||||
return NT_STATUS_RETRY;
|
||||
}
|
||||
|
@ -1418,7 +1418,7 @@ static bool fork_domain_child(struct winbindd_child *child)
|
||||
|
||||
while (1) {
|
||||
|
||||
int ret = 0;
|
||||
int ret;
|
||||
fd_set r_fds;
|
||||
fd_set w_fds;
|
||||
int maxfd;
|
||||
@ -1429,7 +1429,7 @@ static bool fork_domain_child(struct winbindd_child *child)
|
||||
int iov_count;
|
||||
NTSTATUS status;
|
||||
|
||||
if (run_events(winbind_event_context(), &ret, NULL, NULL)) {
|
||||
if (run_events(winbind_event_context(), 0, NULL, NULL)) {
|
||||
TALLOC_FREE(frame);
|
||||
continue;
|
||||
}
|
||||
@ -1465,7 +1465,7 @@ static bool fork_domain_child(struct winbindd_child *child)
|
||||
|
||||
ret = sys_select(maxfd + 1, &r_fds, &w_fds, NULL, tp);
|
||||
|
||||
if (run_events(winbind_event_context(), &ret, &r_fds, &w_fds)) {
|
||||
if (run_events(winbind_event_context(), ret, &r_fds, &w_fds)) {
|
||||
/* We got a signal - continue. */
|
||||
TALLOC_FREE(frame);
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user