aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-10 11:43:09 +0200
committerMax Kellermann <max@duempel.org>2008-09-10 11:43:09 +0200
commit9ceadb0561d416b3f729fe3471aa7c4ec3ad1456 (patch)
tree46690ff425336297b9036f0c84beda9dc06f4d98
parent1bb154098dc5b52163ebee2eeb224b736836a936 (diff)
downloadmpd-9ceadb0561d416b3f729fe3471aa7c4ec3ad1456.tar.gz
mpd-9ceadb0561d416b3f729fe3471aa7c4ec3ad1456.tar.xz
mpd-9ceadb0561d416b3f729fe3471aa7c4ec3ad1456.zip
client: simplified client_read()
Remove one comparison by changing branch order.
Diffstat (limited to '')
-rw-r--r--src/client.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/client.c b/src/client.c
index d5a7ce616..ac7e44b9a 100644
--- a/src/client.c
+++ b/src/client.c
@@ -453,10 +453,12 @@ static int client_read(struct client *client)
if (bytesRead > 0)
return client_input_received(client, bytesRead);
- else if (bytesRead == 0 || (bytesRead < 0 && errno != EINTR)) {
- return COMMAND_RETURN_CLOSE;
- } else
+ else if (bytesRead < 0 && errno == EINTR)
+ /* try again later, after select() */
return 0;
+ else
+ /* peer disconnected or I/O error */
+ return COMMAND_RETURN_CLOSE;
}
static void client_manager_register_read_fd(fd_set * fds, int *fdmax)