]> git.pond.sub.org Git - empserver/commitdiff
Simplify recvclient() to return -1 for all failures
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 28 Jan 2012 16:49:20 +0000 (17:49 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 20 Feb 2012 06:44:21 +0000 (07:44 +0100)
Callers don't care.  Also fix some comments.

src/lib/player/recvclient.c

index 22a85496b3fdcb83b65c3d87475368934de7d18e..6ec052a40a6c144f36c91f95f087169f21086b9f 100644 (file)
 
 /*
  * 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;