Commit graph

194 commits

Author SHA1 Message Date
ehouse
4df7b3d75a add uptime 2005-10-19 03:39:18 +00:00
ehouse
74b6ccbd52 cleanup ctrl printing; repeat most recent command; cleanup internal names. 2005-10-16 01:19:25 +00:00
ehouse
deea73ad8b cancel all-connected timer when all are connected 2005-10-15 16:35:18 +00:00
ehouse
a8352fa745 fix leak; move heartbeat timer into crefmgr, and only run it when
there are active crefs.
2005-10-15 16:30:10 +00:00
ehouse
936e3bd110 clean up command help 2005-10-15 16:28:26 +00:00
ehouse
ecf5875d7e capitalize public methods on timermgr (no code change) 2005-10-15 15:49:22 +00:00
ehouse
eb8301ade7 return error to client when flags indicate old version; close sockets
when error occurs in processing message.
2005-10-14 08:29:58 +00:00
ehouse
6541e56c40 catch up with logf change 2005-10-14 08:27:16 +00:00
ehouse
b7e3479989 print prompt 2005-10-14 08:26:56 +00:00
ehouse
cb3e2910b9 add commented out debug flag 2005-10-14 08:26:19 +00:00
ehouse
e18f66f587 remove dead code 2005-10-06 02:54:05 +00:00
ehouse
be5078e8f8 removed unused states etc. 2005-10-06 02:36:45 +00:00
ehouse
f7443c9f7f catch symbian up with api changes -- but still need to set timers
before it'll talk to relay.
2005-10-02 16:40:16 +00:00
ehouse
3bf3e2fda1 parse multiple config files in order with later ones overriding. 2005-10-02 16:23:49 +00:00
ehouse
4e5f69f4e8 rename states so can format to 80 cols; add log level param. No
change to functionality in this checkin.
2005-10-02 16:08:42 +00:00
ehouse
6835b6d1eb New scheme for accepting and limiting reconnections. Now device must
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.
2005-10-02 15:39:38 +00:00
ehouse
77319b570d make transmitted vars smaller where possible; new relay identifying
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.
2005-10-01 16:33:45 +00:00
ehouse
0c2365e3ea parse new SERVERNAME config variable 2005-10-01 16:09:57 +00:00
ehouse
255656f009 works, but not yet used. And wants relay host identifier added in. 2005-09-19 04:34:51 +00:00
ehouse
7d9a78f996 comment out internal mutexes: shouldn't be needed now that only one
thread at a time is given access to a cref instance.
2005-09-14 05:15:27 +00:00
ehouse
f944b154fc fix print_cookies to use iterator 2005-09-14 05:14:41 +00:00
ehouse
c4d212f78c shorten names so table easier to fit in 80 cols 2005-09-14 05:14:04 +00:00
ehouse
87d1c8f593 event name change 2005-09-09 03:15:06 +00:00
ehouse
cf5906eacf Add and handle disconnect message so a device can reuse its socket for
a new game.
2005-09-05 15:50:49 +00:00
ehouse
05878f11a4 Do nothing rather than assert when socket no longer found for write.
Not sure if this is a preventable error.
2005-09-05 15:50:28 +00:00
ehouse
235556240f Don't close the underlying socket. Not sure yet when I should close a
socket that hasn't returned an error.  Maybe that's the client's job.
2005-09-05 15:45:22 +00:00
ehouse
47030320f4 move typedef 2005-09-04 20:55:07 +00:00
ehouse
8a2eae0887 log ip address of incoming connection in dotted-quad notation. 2005-09-04 20:54:09 +00:00
ehouse
89f1eca340 log tweak 2005-09-04 20:44:46 +00:00
ehouse
55988dcdd7 cut down on logging a bit 2005-09-04 20:43:53 +00:00
ehouse
6995d37ead don't assert when unexpected event arrives; just log and drop 2005-09-04 20:43:23 +00:00
ehouse
aa1323a5a3 shorten log messages; make easier to process from perl 2005-09-04 20:38:23 +00:00
ehouse
ebcc30dd5f send notice when a socket closes. This seems to be resulting in dups. 2005-09-04 20:37:42 +00:00
ehouse
0134c96962 fix deadlock by collecting crefs into local storage before starting to
act on them.
2005-09-04 20:36:53 +00:00
ehouse
1f43831219 new error code 2005-09-04 14:35:13 +00:00
ehouse
4882c92a07 generate XWRELAY_OTHERCONNECT message 2005-09-03 18:35:34 +00:00
ehouse
8072bc687c add XWRELAY_OTHERCONNECT message 2005-09-03 18:32:12 +00:00
ehouse
e6e9646253 make all APIs private and add as friends the safe classes that will
access them.  This should allow reduction in the locking within cref
instances since only one thread at a time will be permitted inside by
SafeCref.
2005-09-03 15:59:48 +00:00
ehouse
4479933657 add missing state transition 2005-09-03 15:41:59 +00:00
ehouse
a4033a44c3 when one device is disconnected for heartbeat, tell others it's going
away.
2005-09-03 15:41:17 +00:00
ehouse
9a2567252b cleanup: get rid of unused states/actions and code to handle them. 2005-09-03 07:15:05 +00:00
ehouse
c82fd2e4f2 Send disconnect events with error codes on heartbeat and connect timer
failures; change how state machine handles heartbeats: only put events
into the machine when there's a failure.
2005-09-03 06:55:08 +00:00
ehouse
b0cc6f458b add disconnect event and error codes 2005-09-03 06:46:03 +00:00
ehouse
2ba0f451a7 fix failure to record bytes forwarded 2005-09-02 07:18:39 +00:00
ehouse
8f32f4f99a loads of changes: get settings from config file; remove sockets and
kill crefs via state machine, and protect access to a cref so it can
die without another thread being in it; do timers via timeout to
poll() rather than interrupt (and integrate into state machine);
detect when all players are present and change state so new
connections on that cookie will get a new cref.
2005-09-02 06:56:34 +00:00
ehouse
5d22be174a initial version 2005-09-02 06:40:34 +00:00
ehouse
9ac04243b5 first checked in. works. 2005-09-02 06:35:25 +00:00
ehouse
abde767154 tweaks to logging and adding some message enums 2005-08-08 23:33:51 +00:00
ehouse
23739eee9b reduce interrupt-time logging 2005-08-03 01:17:49 +00:00
ehouse
91abdb3bcc fix bug where client connecting before server would result in attempt
to forward packet to host not yet available.  Drop such packets now.
2005-08-02 04:57:13 +00:00
ehouse
170ad8f419 make overly verbose logging conditional 2005-08-02 04:56:08 +00:00
ehouse
3b53363e16 Pass protocol version code with connect request, and return error if
it isn't what relay can handle.  Report error to user.
2005-07-06 01:36:52 +00:00
ehouse
d639e9ca45 Honor cookieID passed in connect message, falling back to cookie only
when the ID isn't set, and using it rather than assigning a new one
even if the game can't be found.
2005-07-06 00:54:38 +00:00
ehouse
f062a1f8f6 cleanup 2005-07-06 00:53:19 +00:00
ehouse
1ae6c010c9 Make cookieID a 32-bit value instead of 16-bit 2005-07-05 23:02:15 +00:00
ehouse
db6f6c258d move to using a formal table-driven state machine for each game (cref
object).  While it makes things more complex at this point, it should
make it easier in the long run to add error handling, timeouts, etc.
2005-07-05 22:05:37 +00:00
ehouse
d5858f7a21 add include file 2005-07-05 21:57:00 +00:00
ehouse
370c2f82f2 fix leak 2005-07-05 21:52:24 +00:00
ehouse
3054637842 heartbeats: send to clients in connection response; note when
heartbeat and other messages arrive; and periodically reap sockets
that haven't been active in long enough.
2005-06-23 04:26:44 +00:00
ehouse
f702a75188 log incoming ip addr 2005-05-01 17:38:11 +00:00
ehouse
9fa68e4936 lots of little changes; cleanup and support ctrl functions 2005-04-20 12:13:20 +00:00
ehouse
df17fe4f1e reorganize; support ctrl functions 2005-04-20 12:10:05 +00:00
ehouse
d885af5386 count bytes sent 2005-04-20 12:08:33 +00:00
ehouse
92c2017cae use rwlock instead of mutex 2005-04-20 12:06:25 +00:00
ehouse
7036e53229 move to using rwlock 2005-04-20 12:03:58 +00:00
ehouse
12fc28315c more debug info 2005-04-20 11:59:08 +00:00
ehouse
40351e187b add several new commands 2005-04-20 11:57:26 +00:00
ehouse
54843e68bf fix warnings 2005-04-08 14:28:04 +00:00
ehouse
fdca4b0a88 add rwlock helper classes 2005-04-08 14:18:14 +00:00
ehouse
a809a057e4 mutex replaced by rwlock 2005-04-08 14:17:28 +00:00
ehouse
a50fe1d1be replace mutex with rwlock; move creation inside class so can be
controlled by same rwlock.
2005-04-08 14:15:23 +00:00
ehouse
7a15f44c12 move creation inside class so can be controlled by same rwlock 2005-04-08 14:13:25 +00:00
ehouse
423ff190ea turn on warnings 2005-04-08 14:11:00 +00:00
ehouse
9ee54bf8a3 don't assert after poll returns! Instead close socket on hangup. 2005-04-03 17:02:09 +00:00
ehouse
e3151bdfe2 add command parsing and dispatch table 2005-03-31 02:20:50 +00:00
ehouse
a024c7ccd5 first checked in. works but not robust 2005-03-31 02:11:51 +00:00
ehouse
3f64d755b6 break up compile; new file 2005-03-30 02:00:15 +00:00
ehouse
db3ce42a4f this file owns thread creation now 2005-03-30 01:52:10 +00:00
ehouse
9dcec7d66c new include 2005-03-30 01:49:40 +00:00
ehouse
99d713bd8a first checked in 2005-03-30 01:47:55 +00:00
ehouse
855bc67b17 use new thread pool class 2005-03-30 01:42:28 +00:00
ehouse
64c7513867 cleanup 2005-03-30 01:32:02 +00:00
ehouse
3d40cc0e5c add cmd to lock/unlock main mutex 2005-03-25 03:24:00 +00:00
ehouse
97323636a9 use new stack-based lock 2005-03-25 03:21:16 +00:00
ehouse
3fd6998c2a add mutexes; general improvements 2005-03-25 02:59:44 +00:00
ehouse
120a3c1773 first checked in 2005-03-25 02:59:10 +00:00
ehouse
8b34f57bf9 don't kill socket when client connects before server 2005-03-21 05:30:55 +00:00
ehouse
dcebf5bc78 remove null-dereference when socket closed by two threads 2005-03-21 05:30:12 +00:00
ehouse
dc25eb9e35 first checked in. 2005-03-19 22:16:49 +00:00
ehouse
73104819bd first checked in. primative, but works. 2005-03-19 22:14:27 +00:00
ehouse
50d8c1067b total rewrite. New protocol eliminates need to store and forward
messages: clients connect, then messages are passthru only.  Add
control port.  Use stl map and vector to remove limit on number of
connections.  Also removed synchronization, which need to be re-added.
2005-03-19 22:13:43 +00:00
ehouse
ab6d11a32a add two new .cpp files 2005-03-19 22:09:03 +00:00
ehouse
9b9f71322f first checked in 2005-03-06 18:30:59 +00:00
ehouse
39225c8622 first checkin. Works about half the time for one or two games at a
time.  Very fragile.
2005-03-06 18:27:16 +00:00