]> git.pond.sub.org Git - empserver/commitdiff
Fix recvclient() to obey max_idle for output, too
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 11 Mar 2012 11:35:18 +0000 (12:35 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 26 Apr 2012 17:43:42 +0000 (19:43 +0200)
recvclient() flushes the output queue before receiving input.  The
receive obeys max_idle, the flush doesn't.

Broken in commit 08b94556 (v4.3.20) "Reimplement max_idle without a
separate thread".  Until then, the idle thread aborted a stuck attempt
to flush output.

src/lib/player/recvclient.c

index 7dacb4508c88a108372590ce980db3f19330d4af..f9f3453481d09ca53a8f27cca811ef60cbbebf2d 100644 (file)
@@ -81,8 +81,9 @@ recvclient(char *cmd, int size)
         * Flush all queued output before potentially sleeping in
         * io_input(), to make sure player sees the prompt.
         */
-       deadline = (time_t)(player->may_sleep >= PLAYER_SLEEP_ON_INPUT
-                           ? -1 : 0);
+       deadline = player->curup + minutes(max_idle);
+       if (player->may_sleep < PLAYER_SLEEP_ON_INPUT)
+           deadline = 0;
        while (io_output(player->iop, deadline) > 0)
            ;