name. All new connections are stored together, and after each
connection an attempt is made to build one complete game with a host
and however many guests. All remaining devices are moved into a new
pending record in the same state, and the completed game is treated as
always. Seems to work, though nearly 20% of linux instances are
failing to connect the relay run from the new test script samename.sh.
Need to figure out why.
Also added logging of seed and connname to comms.c since games
launched together can no longer be certain to connect on the relay.
This allows the test script to identify joined games from their logs
and detect success or failure.
This checkin changes the relay protocol, so relay and clients will
both need to be upgraded.
setting connName when all in a game are present. Second, have every
host include in connections a random number. That number is made part
of the connName and in general used to test whether a host belongs in
a particular game. Add this "seed" to web interface. Means new
versions for relay protocol and game stream format. Latter is handled
correctly so older games can be opened.
cookie winds up connecting to the old game -- by flagging a cref as
full and no longer accepting connections without connNames even when
in the MISSING state. Required a protocol changes so that devices get
their connNames as early as possible.
ALLHERE message and connName: change relay protocol so cookie is
included in RECONNECT message, and hostIDs are not assigned until
ALLHERE, and change host-to-game matching to use connName first but
fall back to cookie. This fixes nearly all cases failing to reconnect
after relay goes down.
another wanted to operate on them. The root problem is that you can't
dispose of a mutex while somebody's blocking on it. So now the
locking mutexes live inside the cref class. When the lock owner
realizes the cref needs to die, it sets a flag and it's moved to a
recycled list. A thread blocking on the mutex will then get it, but
checks the flag and releases it immediately if it's being recycled.
(Also improve the http interface a bit.) With these changes I've run
31K (and counting) games against the relay without a crash or deadlock
(using sim_real.sh.) The main problem that remains is that sometimes
two games using the same cookie wind up with two crefs (and so never
connect.)
sockets found while reporting closed sockets (to avoid deadlock);
remove sockets from crefmgr's map when closing them so new connections
using same (re-used) socket aren't treated as belonging to open games.
to returing values for string keys so adding a new config doesn't mean
modifying that class. Then add new config for addr passed to bind so
relay can be run to accept http connections from remote machines.
lock. (This bug has always been there, but didn't matter before;
maybe pthreads changed.) Comment out self-spawning stuff until can
fix df-transfer problems. Other minor changes around logging.
send player counts, local and expected. Based on these the relay
accepts connections, declares the game full and ready for message
forwarding, and decides whether to accept a reconnect.
scheme where cookie is used only to connect, and is replaced for
reconnects by a relay-generated name that's supposed to be unique
across all games on all relays and includes a hostname read in from
config file; relay assign non-servers' hostIDs.