Clean up how recvclient() deals with command abortion
We must not block in io_input() after command abortion unblocked io_output(). Instead of checking player->aborted, compute the deadline according to player->may_sleep, like we do for io_output().
This commit is contained in:
parent
1dd44b7eea
commit
7cca82578d
1 changed files with 7 additions and 6 deletions
|
@ -87,13 +87,14 @@ recvclient(char *cmd, int size)
|
||||||
;
|
;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If io_output() blocked and got unblocked by command
|
* Try to receive some input. Need to check player->may_sleep
|
||||||
* abortion, we must return without blocking in io_input().
|
* again; command abortion during io_output() might have
|
||||||
|
* changed it.
|
||||||
*/
|
*/
|
||||||
if (player->aborted)
|
deadline = player->curup + minutes(max_idle);
|
||||||
break;
|
if (player->may_sleep < PLAYER_SLEEP_ON_INPUT)
|
||||||
|
deadline = 0;
|
||||||
res = io_input(player->iop, player->curup + minutes(max_idle));
|
res = io_input(player->iop, deadline);
|
||||||
if (res > 0)
|
if (res > 0)
|
||||||
;
|
;
|
||||||
else if (res < 0)
|
else if (res < 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue