* Known contributors to this file:
* Dave Pare, 1994
* Steve McClure, 2000
- * Markus Armbruster, 2004-2011
+ * Markus Armbruster, 2004-2012
* Ron Koenderink, 2005-2009
*/
void
player_login(void *ud)
{
+ struct timeval timeout;
char buf[128];
char space[128];
int ac;
for (;;) {
io_output(player->iop, 1);
if (io_gets(player->iop, buf, sizeof(buf)) < 0) {
- res = io_input(player->iop, 1);
+ io_timeout(&timeout, player->curup + minutes(max_idle));
+ res = io_input(player->iop, &timeout);
if (res <= 0) {
if (res == 0 && !io_eof(player->iop))
pr_id(player, C_DATA, "idle connection terminated\n");
}
player->state = PS_SHUTDOWN;
pr_id(player, C_EXIT, "so long...\n");
- while (io_output(player->iop, 1) > 0) ;
player_delete(player);
empth_exit();
/*NOTREACHED*/
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;
}