Don't log out player when update aborts a command
authorMarkus Armbruster <armbru@pond.sub.org>
Wed, 25 Feb 2009 21:52:39 +0000 (22:52 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Wed, 25 Feb 2009 21:53:33 +0000 (22:53 +0100)
recvclient() confused command abortion with an idle timeout.  Broken
in commit 08b94556, v4.3.20.

src/lib/player/recvclient.c

index a34b278a716a47dea61b81773d24a24ba189417c..06ab8ae7620ba6ca86ae6a937d1d17f0b13edd86 100644 (file)
@@ -29,7 +29,7 @@
  *
  *  Known contributors to this file:
  *     Dave Pare, 1986
- *     Markus Armbruster, 2006-2008
+ *     Markus Armbruster, 2006-2009
  *     Ron Koenderink, 2009
  */
 
@@ -59,7 +59,7 @@
 int
 recvclient(char *cmd, int size)
 {
-    int count;
+    int count, res;
 
     count = -1;
     while (!player->aborted) {
@@ -85,11 +85,15 @@ recvclient(char *cmd, int size)
        if (player->aborted)
            break;
 
-       if (io_input(player->iop, IO_WAIT) <= 0) {
-           if (!io_error(player->iop) && !io_eof(player->iop)) {
-               pr_flash(player, "idle connection terminated\n");
-               player->state = PS_SHUTDOWN;
-           }
+       res = io_input(player->iop, IO_WAIT);
+       if (res > 0)
+           ;
+       else if (res < 0)
+           player->aborted = player->eof = 1;
+       else if (io_eof(player->iop))
+           player->aborted = player->eof = 1;
+       else if (!player->aborted) {
+           pr_flash(player, "idle connection terminated\n");
            player->aborted = player->eof = 1;
        }
     }