connect first, guests second, with clear error messages if the order's
wrong. This seems to make it simpler for users to get a connection
right. Code holding multiple games worth of hosts and guests in a
cref is gone.
that all devices must be connected initially and that it's all memory
based so a crash wipes stored messages.) Accept messages for
forwarding when in the MISSING state, not just the ALLHERE state.
Store messages that can't be sent now, and send any that have
accumulated when a host reconnects. When a cref loses its last
connection, keep it around unless it has no messages stored (as will
be the case when a game ends.)
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.)