]> git.pond.sub.org Git - empserver/commit
Fix client not to hang when EOF on stdin overtakes C_EXECUTE
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 5 Apr 2009 08:58:30 +0000 (10:58 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 5 Apr 2009 08:58:30 +0000 (10:58 +0200)
commit2196ffd55c869505f63f3d806c3f7475b52ae12d
tree27178f760e5ca67dd7fcf9449a7222a6936a6113
parent92ce7cf665cc0b51e515c2f3fa4e3715c9cc9e24
Fix client not to hang when EOF on stdin overtakes C_EXECUTE

Player input may overtake batch file contents (well-known protocol
flaw, see doc/clients-howto for details).  This includes EOF.  When
that happens, the client closes standard input, sends an EOF cookie,
and continues reading output until the server closes the connection.
When it gets C_EXECUTE, it redirects input to the batch file.  But it
then failed to read the batch file.  The server waited forever for the
execute's EOF cookie, the client waited forever for the server closing
the connection.

Fix by stopping only reading from standard input.  Broken in 8b7d0b91,
v4.3.11.

Note that the EOF cookie still overtakes the batch file contents,
which makes the server interpret the input between the execute command
and the EOF as batch file, and the batch file contents as ordinary
input.
src/client/play.c