play_cmd() needs to return in a state that makes player_login() break
the login command loop.
play_cmd() assumes player_main() always returns in such a state:
connection's EOF indicator set. Unfortunately, the assumption is
wrong. Fortunately, play_cmd() checks it, oopses and recovers.
player_main() can return with neiter error nor EOF indicator set,
e.g. when the game is down.
player_main() can return with just the error indicator set. For
instance, when the client dies, io_input() detects ECONNRESET, sets
the error indicator and fails.
Broken in commit
8549efbc. Fix by setting the EOF indicator silently
(without oopsing) when necessary.
* Known contributors to this file:
* Dave Pare, 1994
* Steve McClure, 2000
- * Markus Armbruster, 2004-2011
+ * Markus Armbruster, 2004-2012
* Ron Koenderink, 2005-2009
*/
player->state = PS_PLAYING;
player_main(player);
logerror("%s logged out, country #%d", praddr(player), player->cnum);
- if (CANT_HAPPEN(!io_eof(player->iop)))
+ if (!io_eof(player->iop) && !io_error(player->iop))
io_set_eof(player->iop);
return RET_OK;
}