Commit graph

209 commits

Author SHA1 Message Date
ehouse
015b0d42d8 include title in head with summary readable in tab 2009-12-08 14:51:03 +00:00
ehouse
26469d734c Modify state machine and return new error codes to force host to
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.
2009-12-04 08:03:27 +00:00
ehouse
337c36dfd2 remove unused parameter 2009-12-04 07:59:07 +00:00
ehouse
7ad59e3e2b cleanup 2009-12-04 07:54:14 +00:00
ehouse
55478369e4 listen on only one port by default 2009-11-22 16:29:23 +00:00
ehouse
c1827562dc be consistent is use of variable vs real name 2009-11-10 14:37:42 +00:00
ehouse
2ecf415618 Remove on case where HandleEvents was being called recursively and
creating unexpected state transitions; add assert to catch any future
recursion.
2009-11-09 05:30:42 +00:00
ehouse
393cccb86c Add MSGONLY state to indicate cref being kept alive only to preserve
messages for a latter connection.
2009-11-09 05:29:06 +00:00
ehouse
aae12428da Add limited support for store-and-forward (where limitations include
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.)
2009-11-08 21:35:39 +00:00
ehouse
2d4ae3e44a When forwarding message, lookup cref by socket if cookieID == 0, as
can be the case when through to a non-all-connected game.
2009-11-08 21:32:36 +00:00
ehouse
8e0dad43c7 get rid of overlogged message 2009-11-08 21:25:43 +00:00
ehouse
ed52582ea4 get rid of states and code for checking numbers of players -- since
any number is allowed now.
2009-11-03 05:03:20 +00:00
ehouse
3bdfda6548 Make it possible for multiple games to connect using the same room
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.
2009-11-02 01:01:47 +00:00
ehouse
11b586cd4b lookup hearbeat recipient by socket rather then cookieID since
cookieID isn't always correct until later
2009-11-02 00:45:54 +00:00
ehouse
7a71c4636b change varible names; remove instance variable than can be on the stack. 2009-11-01 01:38:03 +00:00
ehouse
0e43675abf Address problems matching [re]connections to games: first, go back to
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.
2009-09-26 14:37:49 +00:00
ehouse
030ae52a4b Store start time as time_t rather than string. 2009-09-26 14:05:51 +00:00
ehouse
b219e8b279 Send notification when device disconnnects without closing socket (in
addition to the existing one sent when a socket is closed).
2009-09-20 18:47:47 +00:00
ehouse
ffacbcb36a Move "For" column left. 2009-09-19 04:59:19 +00:00
ehouse
45bdccd4e8 Format time more compactly 2009-09-18 03:50:01 +00:00
ehouse
a9e8f5b493 shorten column headings; don't assign cid until game is full. 2009-09-17 03:42:12 +00:00
ehouse
d5d20293ce print log timestamps with padding 0s for better sorting 2009-09-15 12:54:40 +00:00
ehouse
135048a3cf Extend name change to relay's web interface 2009-09-14 03:31:54 +00:00
ehouse
18e9301e87 rename Cookie to Invite, a change that may change. Rename everywhere
in clients but not in relay where cookie is too pervasive.  (There are
no code changes in this checkin.)
2009-09-14 03:11:11 +00:00
ehouse
6603949b0e Fix bug where device quitting one game to start another with same
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.
2009-09-14 01:55:03 +00:00
ehouse
7eeede45c3 exit if unable to open socket 2009-09-13 15:27:19 +00:00
ehouse
7ca629a2f5 don't log socket closing as an error 2009-09-04 11:02:09 +00:00
ehouse
95a70862be Lock cref before calling method that assumes lock. 2009-08-30 15:18:40 +00:00
ehouse
2a569df97f For privacy, don't show host IP unless connection is local. 2009-08-30 15:16:06 +00:00
ehouse
b15665e041 serve http view from cached data and make cache refresh rate
configurable.  Should make it harder to attack the relay on http port.
2009-08-21 12:32:57 +00:00
ehouse
dbf9daf71b Fix problems reconnecting hosts where some but not all received the
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.
2009-08-21 12:00:09 +00:00
ehouse
493d3c226f log when crash 2009-08-20 12:12:43 +00:00
ehouse
53133839a4 don't log list of sockets by default 2009-08-20 03:50:40 +00:00
ehouse
e96becb05f variable name change only (for clarity) 2009-08-13 12:59:55 +00:00
ehouse
47d6d53419 make log file location configurable; remember start time as used for
permenent IDs on spawn rather than overall boot to avoid duplicating
cids.
2009-07-31 13:02:05 +00:00
ehouse
7077a11af6 pass .css file 2009-07-31 12:58:47 +00:00
ehouse
acbf8180ef add missing lock(); track and display uptime of daemon child as well as parent 2009-07-31 12:56:04 +00:00
ehouse
80ccdd6d04 spelling... 2009-07-31 12:47:58 +00:00
ehouse
f537169db5 Assign 0 not NULL to pthread variables. 2009-07-31 12:43:04 +00:00
ehouse
bcc887c0b1 Need to remove before inserting. Todo: is there a replace? 2009-07-31 12:39:47 +00:00
ehouse
503db9cc6f up copyright 2009-07-30 12:54:17 +00:00
ehouse
f35f2fe696 add css file path 2009-07-30 12:52:05 +00:00
ehouse
ba97f096dc make css file for http interface configurable; fix bug where
connections arriving too close together would wind up with different
crefs (using new mutex).
2009-07-30 12:49:21 +00:00
ehouse
631bf4b179 write to named file for use on ISP from cron 2009-07-30 12:46:40 +00:00
ehouse
2641ab6430 bug fix: mark after locking so will unlock in destructor 2009-07-30 12:39:45 +00:00
ehouse
4a5d74a0af rename state to take up less space in browser; add number of respawns
to status display.
2009-07-29 04:25:21 +00:00
ehouse
8be31357ad track per-cref lifetime and display it via http 2009-07-28 05:41:15 +00:00
ehouse
8284799abe Fix crashes resulting from deleting cref instances in one thread while
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.)
2009-07-28 05:15:26 +00:00
ehouse
0d03ed71bb cleanup 2009-07-28 05:09:24 +00:00
ehouse
6b1cf247bf Don't alloc storage for fds and log buffer each time through poll
loop; instead reuse and realloc when needs to grow.
2009-07-28 05:08:15 +00:00