Commit graph

194 commits

Author SHA1 Message Date
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
ehouse
8c7c457a54 shorten state names so they take up less webpage space. 2009-07-28 05:06:25 +00:00
ehouse
3b62e04d07 don't use -lmcheck. It causes a lot of crashes in places where it
certainly looks as if nothing is wrong.
2009-07-28 05:00:18 +00:00
ehouse
dddd5e1dd8 clean up logging. I got some cores that suggest overflow. This fixes
that if indeed it was happening.  Problems with sockets disappearing
while in poll may remain.
2009-07-16 04:43:33 +00:00
ehouse
0a0d4804dd store keys and values as const char* instead of string since the
string code was involved in a lot of crashes.
2009-07-16 04:23:02 +00:00
ehouse
8a0d963c95 include abbreviated uptime in stat row 2009-07-16 02:56:25 +00:00
ehouse
c5e73fd725 Add to http display number of games currently being hosted. 2009-07-13 03:01:22 +00:00
ehouse
582eb88f9a int->bool 2009-07-13 02:58:16 +00:00
ehouse
854b3d9349 use synchronized method to add map entries 2009-07-06 02:02:59 +00:00
ehouse
2ef16d44ca Include number of games played in html output; don't report closed
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.
2009-07-06 01:50:51 +00:00
ehouse
a680a6e5fe Always close sockets we're done with. Otherwise they leak -- don't get reused. 2009-07-06 01:32:30 +00:00
ehouse
37dc9b7b88 running under valgrind I need to handle SIGPIPE. 2009-07-06 01:31:16 +00:00
ehouse
f4db39f490 synchronize reads of std::map to fix crash due to memory corruption.
Apparently containers aren't thread-safe even for reads.
2009-07-03 14:54:21 +00:00
ehouse
9b29e45ea4 plug valgrind-found leak; prefer localtime_r. 2009-06-29 12:58:30 +00:00
ehouse
4a308f4f8e Don't use unitialized variables (thanks valgrind :-) 2009-04-05 18:47:45 +00:00
ehouse
fbe95478ba rename now() as uptime(); drop NTHREADS to 1 for now; include time of
server boot in connName and keep counter in memory rather than a file.
2009-03-10 12:52:17 +00:00