aboutsummaryrefslogtreecommitdiffstats
path: root/src/client.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-10 11:43:09 +0200
committerEric Wong <normalperson@yhbt.net>2008-09-10 23:34:54 -0700
commite63e56c4e3a0d902dada9d47298517afc1aa16a3 (patch)
treedb2193937a558af3ecc2974707b60b8192845256 /src/client.c
parent929e0e6d351a4a231d3b7aeb08df571be5d3b949 (diff)
downloadmpd-e63e56c4e3a0d902dada9d47298517afc1aa16a3.tar.gz
mpd-e63e56c4e3a0d902dada9d47298517afc1aa16a3.tar.xz
mpd-e63e56c4e3a0d902dada9d47298517afc1aa16a3.zip
client: simplified client_read()
Remove one comparison by changing branch order.
Diffstat (limited to 'src/client.c')
-rw-r--r--src/client.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/client.c b/src/client.c
index 381b4713b..ce8d731a6 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)