recvclient: Track potential yield on input

recvclient() calls ef_make_stale() only when it does actual I/O, via
io_output() and io_input().  Missed in commit 2fa5f652, v4.3.24.  Call
it directly when it doesn't do actual I/O.

This makes navi-march-test expose a bug in march: when the player
declines to abandon a sector, we write back stale land units,
triggering a generation oops.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2015-11-29 10:20:52 +01:00
parent 9645caf6ff
commit 8daeffbd8f
2 changed files with 8 additions and 1 deletions

View file

@ -28,13 +28,14 @@
* *
* Known contributors to this file: * Known contributors to this file:
* Dave Pare, 1986 * Dave Pare, 1986
* Markus Armbruster, 2006-2012 * Markus Armbruster, 2006-2015
* Ron Koenderink, 2009 * Ron Koenderink, 2009
*/ */
#include <config.h> #include <config.h>
#include "empio.h" #include "empio.h"
#include "file.h"
#include "journal.h" #include "journal.h"
#include "player.h" #include "player.h"
#include "prototypes.h" #include "prototypes.h"
@ -68,6 +69,8 @@ recvclient(char *cmd, int size)
count = io_gets(player->iop, cmd, size); count = io_gets(player->iop, cmd, size);
if (count >= 0) { if (count >= 0) {
/* got it */ /* got it */
if (player_io_deadline(player, 0))
ef_make_stale();
if (strcmp(cmd, "ctld") == 0) if (strcmp(cmd, "ctld") == 0)
player->aborted = player->got_ctld = 1; player->aborted = player->got_ctld = 1;
if (strcmp(cmd, "aborted") == 0) if (strcmp(cmd, "aborted") == 0)

View file

@ -12,6 +12,10 @@ tester@127.0.0.1 logged out, country #1
Connect from 127.0.0.1 Connect from 127.0.0.1
tester@127.0.0.1 using country #1 tester@127.0.0.1 using country #1
tester@127.0.0.1 logged in as country #1 tester@127.0.0.1 logged in as country #1
Oops: elt->generation != (ef_generation & 0xfff) in ../src/lib/common/file.c:699
Crash dump complete
Oops: elt->generation != (ef_generation & 0xfff) in ../src/lib/common/file.c:699
Crash dump complete
tester@127.0.0.1 logged out, country #1 tester@127.0.0.1 logged out, country #1
Connect from 127.0.0.1 Connect from 127.0.0.1
tester@127.0.0.1 using country #0 tester@127.0.0.1 using country #0