Flush all output before reading a login command, not just some
Before, a client could theoretically make the output queue grow without bounds.
This commit is contained in:
parent
5ce099f671
commit
d381351c65
1 changed files with 5 additions and 1 deletions
|
@ -87,7 +87,11 @@ player_login(void *ud)
|
||||||
pr_id(player, C_INIT, "Empire server ready\n");
|
pr_id(player, C_INIT, "Empire server ready\n");
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
io_output(player->iop, (time_t)-1);
|
if (io_outputwaiting(player->iop)) {
|
||||||
|
if (io_output(player->iop, (time_t)-1) <= 0)
|
||||||
|
break;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (io_gets(player->iop, buf, sizeof(buf)) < 0) {
|
if (io_gets(player->iop, buf, sizeof(buf)) < 0) {
|
||||||
res = io_input(player->iop, player->curup + minutes(max_idle));
|
res = io_input(player->iop, player->curup + minutes(max_idle));
|
||||||
if (res <= 0) {
|
if (res <= 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue