diff options
author | Max Kellermann <max@duempel.org> | 2008-08-28 20:20:10 +0200 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-09-01 18:35:19 -0700 |
commit | 1cb70dcaf7d733c4bbf55d6071d7eabd28651814 (patch) | |
tree | 8cfc76ac7a14218a29e8b725e2cda52ccc31935c /src | |
parent | 592d7484ce76fde36c78dc85a6099149c42b734c (diff) | |
download | mpd-1cb70dcaf7d733c4bbf55d6071d7eabd28651814.tar.gz mpd-1cb70dcaf7d733c4bbf55d6071d7eabd28651814.tar.xz mpd-1cb70dcaf7d733c4bbf55d6071d7eabd28651814.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/client.c | 36 |
1 files changed, 6 insertions, 30 deletions
diff --git a/src/client.c b/src/client.c index 4bb11ba5a..6ee9b988d 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; @@ -508,19 +488,15 @@ int client_manager_io(void) registered_IO_add_fds(&fdmax, &rfds, &wfds, &efds); selret = select(fdmax + 1, &rfds, &wfds, &efds, NULL); - 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) { |