Andy2
f96f4a040b
add new proxy command that fetches actual messages stored for a device.
2011-01-22 12:52:26 -08:00
Andy2
96fead3164
add msglen column to msgs table to be used to avoid calculating size
...
later. Stores size of string as it was passed to db, not as stored.
2011-01-21 06:46:49 -08:00
Eric House
4bd5553596
track mtime per host rather than per game -- make it an array in the db.
2010-12-01 21:08:22 -08:00
Andy2
daecc807c1
don't init nPerDevice, and deal with it not being inited.
2010-11-22 20:43:37 -08:00
Eric House
4c6c3c1ded
when marking a device in a dead game, negate its nperdevice entry rather than always using -1.
2010-11-16 20:28:53 -08:00
Andy2
ea292c7e2f
exclude dead games when looking for open public rooms
2010-11-15 19:01:11 -08:00
Andy2
feca7345dc
add GameFull -- database, not in-memory state, knows if game is full.
2010-11-15 06:48:36 -08:00
Andy2
0787a06eb5
accept new message from device announcing the death of a game
...
(including seed so it's harder to spoof); respond to that by setting a
DEAD column in the db and flagging the device as gone. Notify any
connected device of the fact. Refuse to accept new connections to
that game. As already-connected devices reconnect, allow them to do
so but send a new status message that their game is dead. Not heavily
tested yet.
2010-11-11 06:40:50 -08:00
Andy2
c8d7ca40a5
use \1 instead of \n as delimiter -- in case somebody passes as string
...
containing a \n.
2010-11-09 18:02:22 -08:00
Andy2
0f111ab363
use PQexecParams instead of PQexec for queries involving strings from
...
users (i.e. room names) to avoid crashes when the contain apostrophes
-- and in general to be safer.
2010-11-09 17:27:33 -08:00
Andy2
d2782af487
do case-insensitive comparison of room names
2010-11-06 18:52:10 -07:00
Andy2
633d4c95a7
fix buffer overflow sql error with large messages; combine logged messages.
2010-11-03 18:12:26 -07:00
Andy2
7cf4535b4c
new dbmgr API returns number of players in game; use that rather than
...
currently connected devices to populate [RE]CONNECT message
2010-10-22 22:34:43 -07:00
Eric House
34df149046
include age of room with info returned for open public rooms
2010-10-14 22:16:21 -07:00
Eric House
86d73392d5
track bytes sent in db; use defaults to init ctime
2010-10-06 21:45:05 -07:00
Eric House
2e844d798f
replace single db connection protected by a mutex with one connection per thread kept in thread-local storage.
2010-10-04 20:04:14 -07:00
Andy2
89f967a016
pass remaining reconnect params in case connName's missing from db.
...
Should only matter if the relay's db's been deleted.
2010-10-04 18:39:26 -07:00
Eric House
d35bc7d748
refuse to store more than four messages at a time for a single
...
connName/hid pair. This works around a problem where a device,
continuing to connect and send all pending messages for another device
that is not connecting, winds up with hundreds of identical messages
stored.
2010-10-03 18:18:15 -07:00
Eric House
1b93654f7e
use stored procedure sum_array instead of C macro
2010-09-29 06:21:08 -07:00
Eric House
bc65377cfd
track device seeds in db.
2010-09-28 18:06:50 -07:00
Andy2
1de029f3f0
skip public rooms if full. (Should do this in the query....)
2010-09-28 06:42:01 -07:00
Eric House
8f77886f72
make column name shorter
2010-09-24 20:18:20 -07:00
Andy2
b0c6e6da9c
add db method to count messages for connName/hid pairs and handle
...
query using it.
2010-09-24 05:50:02 -07:00
Andy2
c3e1b243b6
add timestamp to msgs db and set it on adding new records. I will
...
likely need to add periodic culling on the server for games that will
never fetch their messages.
2010-09-24 05:46:30 -07:00
Andy2
eee41377f4
new methods for storing/retrieving messages in new db.
2010-09-23 06:31:29 -07:00
Andy2
85b4f3f075
move hostid assignment and tracking into db so it survives reboots and
...
recycling of crefs between when devices in a game connect. This plus
movement of messages into the DB will re-enable games played without
the two devices ever being connected at the same time.
2010-09-23 05:33:27 -07:00
Andy2
e06baf566f
get public rooms from the db rather than stubbing it out.
2010-09-21 06:54:47 -07:00
Andy2
e7b5923883
finish first pass at sending open public room names -- but with actual
...
list harvesting stubbed out.
2010-09-21 06:27:31 -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
50c387d75e
remove players from db as well as runtime when ack times out
2010-09-16 06:49:35 -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
d1a9c3962a
rename cookie->room in db; reposition columns.
2010-09-16 03:30:24 -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
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
Andy2
3b5b5f0241
factor dbmgr code; add and call method to zero CIDs on boot.
2010-09-15 01:14:28 -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
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