From 5585dda091d3ac85f2d19cbcd87c30b2a69eb781 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 28 Jan 2012 17:49:20 +0100 Subject: [PATCH] Simplify recvclient() to return -1 for all failures Callers don't care. Also fix some comments. --- src/lib/player/recvclient.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/lib/player/recvclient.c b/src/lib/player/recvclient.c index 22a85496b..6ec052a40 100644 --- a/src/lib/player/recvclient.c +++ b/src/lib/player/recvclient.c @@ -41,17 +41,16 @@ /* * Receive a line of input from the current player. - * If the player's eof flag is set, return -1 without receiving input. - * If the player's aborted flag is set, return -2 without receiving + * If the player's aborted flag is set, return -1 without receiving * input. * Else receive one line and store it in CMD[SIZE]. * This may block for input, yielding the processor. Flush buffered * output when blocking, to make sure player sees the prompt. * If the player's connection has the I/O error or EOF indicator set, - * or the line is "ctld", set the player's eof and aborted flag and - * return -1. + * or we block and time out, or the line is "ctld", set the player's + * eof and aborted flag and return -1. * If the line is "aborted", set the player's aborted flag and return - * -2. + * -1. * Else return the length of the line. * Design bug: there is no way to indicate truncation of a long line. */ @@ -83,7 +82,7 @@ recvclient(char *cmd, int size) ; /* - * If io_output_all() blocked and got unblocked by command + * If io_output() blocked and got unblocked by command * abortion, we must return without blocking in io_input(). */ if (player->aborted) @@ -112,7 +111,7 @@ recvclient(char *cmd, int size) CANT_HAPPEN(player->recvfail == 256); empth_sleep(time(NULL) + 60); } - return player->eof ? -1 : -2; + return -1; } player->recvfail = 0; -- 2.43.0