From f6a7dd2b455cc1f08c1c00085ce1801870d6b41e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 28 Aug 2008 20:20:10 +0200 Subject: client: select() errors are fatal Previously, when select() failed, we assumed that there was an invalid file descriptor in one of the client structs. Thus we tried select() one by one. This is bogus, because we should never have invalid file descriptors. Remove it, and make select() errors fatal. --- src/client.c | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/client.c b/src/client.c index 43983dc99..15b8ecf7f 100644 --- a/src/client.c +++ b/src/client.c @@ -469,26 +469,6 @@ static void client_manager_register_write_fd(fd_set * fds, int *fdmax) } } -static void closeNextErroredInterface(void) -{ - struct client *client, *n; - fd_set fds; - struct timeval tv; - - tv.tv_sec = 0; - tv.tv_usec = 0; - - list_for_each_entry_safe(client, n, &clients, siblings) { - FD_ZERO(&fds); - FD_SET(client->fd, &fds); - if (select(client->fd + 1, - &fds, NULL, NULL, &tv) < 0) { - client_close(client); - return; - } - } -} - int client_manager_io(void) { fd_set rfds; @@ -511,19 +491,15 @@ int client_manager_io(void) selret = select(fdmax + 1, &rfds, &wfds, &efds, NULL); main_notify_unlock(); - if (selret < 0 && errno == EINTR) - break; - - registered_IO_consume_fds(&selret, &rfds, &wfds, &efds); - - if (selret == 0) - break; - if (selret < 0) { - closeNextErroredInterface(); - continue; + if (errno == EINTR) + break; + + FATAL("select() failed: %s\n", strerror(errno)); } + registered_IO_consume_fds(&selret, &rfds, &wfds, &efds); + getConnections(&rfds); list_for_each_entry_safe(client, n, &clients, siblings) { -- cgit v1.2.3