Separate login_grace_time from max_idle
max_idle applies in state PS_PLAYING, login_grace_time before (login, state PS_INIT) and after (logout, state PS_SHUTDOWN). Cut login_grace_time to two minutes, from max_idle's 15. Two minutes is plenty to complete login and logout. Makes swamping the server with connections slightly harder, as they get dropped faster. While that makes sense all by itself, the real aim is making increasing max_idle safe. The next commit will complete that job.
This commit is contained in:
parent
fb9595fe6a
commit
1a97cc3cfd
7 changed files with 23 additions and 19 deletions
|
@ -36,7 +36,6 @@
|
|||
|
||||
#include "empio.h"
|
||||
#include "journal.h"
|
||||
#include "optlist.h"
|
||||
#include "player.h"
|
||||
#include "prototypes.h"
|
||||
|
||||
|
@ -81,20 +80,15 @@ recvclient(char *cmd, int size)
|
|||
* Flush all queued output before potentially sleeping in
|
||||
* io_input(), to make sure player sees the prompt.
|
||||
*/
|
||||
deadline = player->curup + minutes(max_idle);
|
||||
if (player->may_sleep < PLAYER_SLEEP_ON_INPUT)
|
||||
deadline = 0;
|
||||
deadline = player_io_deadline(player, 0);
|
||||
while (io_output(player->iop, deadline) > 0)
|
||||
;
|
||||
|
||||
/*
|
||||
* Try to receive some input. Need to check player->may_sleep
|
||||
* again; command abortion during io_output() might have
|
||||
* changed it.
|
||||
* Try to receive some input. Need to recompute deadline;
|
||||
* command abortion during io_output() might have changed it.
|
||||
*/
|
||||
deadline = player->curup + minutes(max_idle);
|
||||
if (player->may_sleep < PLAYER_SLEEP_ON_INPUT)
|
||||
deadline = 0;
|
||||
deadline = player_io_deadline(player, 0);
|
||||
res = io_input(player->iop, deadline);
|
||||
if (res > 0)
|
||||
;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue