Commit graph

4006 commits

Author SHA1 Message Date
Andy2
df1ec1628a replace killSocket(), which jumped right into crefmgr and could get
ahead of processing data arrived on the same socket, with EnqueueKill
that adds to same queue from which data's taken.  So if device dies
immediately after sending data there won't be a race between closing
the cref (if this is the last open socket) and handling the data.  I'm
still dying with assert fails when running 100 games at once, but much
less frequently
2010-09-18 08:47:56 -07:00
Andy2
a4913596db remove logging 2010-09-18 08:42:15 -07:00
Andy2
c5d113a8da remove _locked from name of method since it's not called when holding a lock. 2010-09-18 07:46:10 -07:00
Andy2
53b3d7c32f enque sockets in new object that contains type so later other events
(e.g. socket closes) can also be queued; track what sockets are
currently being handled so no two threads are ever processing events
on same socket.  This makes running 'NGAMES=50
./scripts/discon_ok2.sh' crash very infrequently rather than every
time, but the race condition in crefmgr remains.  Queuing socket
closes should help.
2010-09-18 07:44:14 -07:00
Andy2
54512b9e11 put logs in own dir 2010-09-18 07:35:16 -07:00
Andy2
eec07649a6 put logs in own dir; echo every time game ends successfully. 2010-09-18 07:35:02 -07:00
Andy2
9c8889b429 get rid of mutex guarding reconnect. There shouldn't be any need
since game slots are already assigned, and it's slowing down
reconnects in their race with kills.
2010-09-18 05:07:23 -07:00
Andy2
7e1066dbcc vary room names 2010-09-16 22:20:43 -07:00
Eric House
bb1e46fa81 Merge branch 'relay_proxy' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into relay_proxy 2010-09-16 20:13:54 -07:00
Eric House
d0e707a48e get started with test/cmdline app to query relay's new proxy interface. 2010-09-16 20:13:24 -07:00
Andy2
c5eef29bcc some suspicious crashes and subsequent reading say that multiple
threads can't share the same db connection.  So synchronize all
queries.  Multiple threads *can* access the db concurrently as long as
each has its own connection, so I could add connections to the tpool
threads.  But this will probably be performant enough for the first
10K simultaneous users. :-)
2010-09-16 20:08:32 -07:00
Andy2
1490b2def9 simplify state table, getting rid of a bunch of states: we never leave
ALLCOND until it's time to kill the cref.  When one device connects
and leaves the cref is recycled, so when a new device joins and is
assigned the same game and a new cref is initialized the number of
players already registered must be set from the db entry; do that.
2010-09-16 18:59:56 -07:00
Andy2
76e7459a6d various improvements, e.g. random sleeps before and after starting 2010-09-16 18:56:34 -07:00
Andy2
50c387d75e remove players from db as well as runtime when ack times out 2010-09-16 06:49:35 -07:00
Andy2
ca6039e890 new test script attempting to mimic real-world usage 2010-09-16 05:39:50 -07:00
Andy2
25c1824c45 fix broken assertion and add missing state transitions to fix crashes. 2010-09-16 05:39:25 -07:00
Andy2
2b702b48d6 need to clear CID of record in DB when killing corresponding in-memory
cref or reconnect will fail.
2010-09-16 04:47:17 -07:00
Andy2
452e3fc86b timeout in milliseconds instead of seconds 2010-09-16 04:46:04 -07:00
Andy2
fa50bd00f1 timeout final scores alert 2010-09-16 03:42:57 -07:00
Andy2
d1a9c3962a rename cookie->room in db; reposition columns. 2010-09-16 03:30:24 -07:00
Andy2
b25579b893 greatly simplify state machine for connections. Now (with DEVACK=20
on conf file) newrelay.sh will complete running 50 4-device gtk games.
Haven't tested reconnect case which I almost certianly broke.
2010-09-16 01:53:43 -07:00
Andy2
0d7165f881 add ability to run gtk from newrelay.sh. Trying to run 50 instances
crashes the relay as ACKs take too long to come back.
2010-09-16 01:44:54 -07:00
Andy2
06c8fdc67f stop tracking seeds separately until have a use for 'em separate from
HostRec.  This fixes failure to reconnect so that now a complete game
is possible (gtk version) without the two devices every being
connected at the same time.
2010-09-16 01:13:26 -07:00
Andy2
a870cac86d break connect and reconnect into separate paths to simplify. Be
consistent: nJoined in DB tracks players "ever seen and issued
connName" rather than "currently connected".  Next step: debug game
between two devices never connected at same time.
2010-09-15 14:05:51 -07:00
Andy2
8961910263 field name change 2010-09-15 14:03:59 -07:00
Eric House
b8a431cf01 fix bug in sql statement 2010-09-14 21:28:18 -07:00
Eric House
54d268b718 pass through to database whether room is public 2010-09-14 21:20:11 -07:00
Eric House
e3053370d0 add cmd to build the database and main table 2010-09-14 21:18:04 -07:00
Eric House
ddcc338ed7 don't break out of loop without unlocking mutex 2010-09-14 21:16:16 -07:00
Eric House
56a920740a remove unused funtion declaraion 2010-09-14 21:15:24 -07:00
Eric House
9fc39a55ed add params to set public-room-related booleans; add timeout option on
modal dialogs so gtk version can run unattended.
2010-09-14 21:13:45 -07:00
Andy2
3b5b5f0241 factor dbmgr code; add and call method to zero CIDs on boot. 2010-09-15 01:14:28 -07:00
Andy2
821e4d9c39 add ACK to protocol, returned by device after gets connName on initial
connection.  Space is held for device on assumption ack will come
back, then given up if it fails.
2010-09-14 13:54:52 -07:00
Andy2
f8c1c016cc remove special-case states and handling of first connect; track number
of players sought in the cref itself, adding in constructor, and not
in HostRec instances.  This is cleanup with no behavior change.
2010-09-13 13:49:13 -07:00
Andy2
100ed8532f timestamp records on creation 2010-09-12 05:04:52 -07:00
Andy2
ded6e22180 do finding of open games using database rather than cref list, which
requires updating the number of players when new devices join.  Drop
requirement that cid be unique.
2010-09-12 04:49:03 -07:00
Andy2
663551fcb5 improve db, adding uniqueness contraints. Pass in connName so can
meet that constraint.  Figure out next cid using a query at startup.
2010-09-12 03:57:23 -07:00
Andy2
86a1e943ca make dict settable too 2010-09-12 03:53:39 -07:00
Eric House
c1da64b96a instantiate and use the new dbmgr class 2010-09-11 19:45:04 -07:00
Eric House
87de53cf96 add new class to interface with postgres database in an experiment to
simplify things by using a db to survive a crash/reboot.  So far (with
next checkin) manages to update a db.  Next need to do queries instead
of searches through in-memory data.
2010-09-11 19:44:37 -07:00
eehouse@eehouse.org
0b46455044 Merge branch 'relay_proxy' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into relay_proxy 2010-09-12 02:34:20 -07:00
Andy2
54d49d450a add back state and table entries to get rid of an unused cref. 2010-09-11 01:40:40 -07:00
Andy2
8908ca5b1d ignore new test script's log files 2010-09-11 01:40:05 -07:00
Andy2
1cd2d542f7 new test script 2010-09-11 01:39:20 -07:00
Andy2
d5f2a72227 note that file's out-of-date 2010-09-11 01:28:04 -07:00
Andy2
463e9c3ccf pass langCode in reconnect case too 2010-09-11 01:23:39 -07:00
Andy2
bd71a15ddc turn off heartbeats on client side 2010-09-11 01:23:13 -07:00
Andy2
dc957e1a92 add match test on language code and number of players 2010-09-10 13:45:40 -07:00
Eric House
54611df679 nuke unused variable 2010-09-10 05:55:59 -07:00
Andy2
e60495ff93 read, pass, store and display langCode. Not yet used to route
connections to crefs.
2010-09-10 01:59:37 -07:00