Andy2
b506673946
use only one thread until race condition's fixed
2011-01-19 18:36:50 -08:00
Andy2
3ae62e4704
use an index rather than a ptr to track fd array (so a parallel array
...
can be added)
2011-01-19 18:36:24 -08:00
Eric House
720f78d18a
get rid of ivars used only for http UI
2011-01-04 21:43:10 -08:00
Eric House
11d7de5f0d
display the number of devices (pids) running
2010-12-21 20:52:01 -08:00
Eric House
b65338b643
script for use on relay host
2010-12-07 20:46:02 -08:00
Eric House
d1244da284
script encapsulating sql query that's useful to run (with 'watch') along with discon_ok2.sh
2010-12-02 22:29:36 -08:00
Eric House
ae9dbd1e5c
create mtimes array rather than mtimes timestamp
2010-12-01 21:09:25 -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
1720fbbd50
fix parsing of relay ids by replacing separating \n with \0.
2010-11-23 17:46:16 -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
b91187d6a5
test result when parsing; drop if didn't parse
2010-11-16 20:30:43 -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
635ae053b6
cut down on printing; don't assert-fail when relay's crashed.
2010-11-15 20:40:59 -08:00
Andy2
2c5c7a0dd1
init m_nRoomsFilled -- not sure when this http view feature broke
2010-11-15 20:08:59 -08:00
Andy2
ea292c7e2f
exclude dead games when looking for open public rooms
2010-11-15 19:01:11 -08:00
Andy2
c6bd2125a4
java uses '/' to delimit device id, so we'll make that standard.
2010-11-15 18:27:36 -08:00
Andy2
c36679fe13
init isDead to false. Fixes prolem where if DB entry's missing the
...
value is uninitialized and so device gets warned that other device
resigned even if none did.
2010-11-15 18:21:40 -08:00
Andy2
d4e810c9cb
delimiter changed
2010-11-15 06:51:05 -08:00
Andy2
ce5738a4e1
write the count
2010-11-15 06:50:09 -08:00
Andy2
edf0c40904
track isDead when creating SafeCref for devgone
2010-11-15 06:49:41 -08:00
Andy2
2c9f2572a8
use GameFull()
2010-11-15 06:48:57 -08:00
Andy2
feca7345dc
add GameFull -- database, not in-memory state, knows if game is full.
2010-11-15 06:48:36 -08:00
eehouse@eehouse.org
14579c6e30
Merge branch 'relay_proxy' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into relay_proxy
2010-11-14 19:40:35 -08:00
Eric House
528ae0c986
allow more than one device death per message
2010-11-14 15:19:38 -08:00
Eric House
a8ac30b180
add -d option to test dev-gone on relay
2010-11-14 15:18:49 -08:00
Andy2
43896ff187
remove unused method and variable
2010-11-12 18:25:15 -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
3d59bc7e39
add new DEAD column to track when a game's been deleted
2010-11-11 06:29:21 -08:00
Andy2
04e1b0c22b
new constants, include new status event type, for relay to accept
...
notification of deleted game and communicate that to others in the
game as they connect.
2010-11-11 06:26:59 -08:00
eehouse@eehouse.org
7929167129
Merge branch 'android_branch' into relay_proxy
2010-11-10 07:06:10 -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
Eric House
2a2f4d4395
been a while since cvs...
2010-11-09 05:53:49 -08:00
Andy2
d2782af487
do case-insensitive comparison of room names
2010-11-06 18:52:10 -07:00
Andy2
d1fcdb69da
double max room name len since the old value was too small -- only
...
filled half a text field on android
2010-11-03 18:38:43 -07:00
Andy2
c7febf0d10
nuke unused constant
2010-11-03 18:30:05 -07:00
Andy2
0148a93f3e
add a constraint to the stored messages table to avoid dupes. Then
...
remove the artificial limit on number of stored messages. This seems
to fix problems where lots of chats in a row clog up the relay so that
messages never get flowing again. Works more cleanly than
artificially ACKing.
2010-11-03 18:14:19 -07:00
Andy2
633d4c95a7
fix buffer overflow sql error with large messages; combine logged messages.
2010-11-03 18:12:26 -07:00
Andy2
b237277544
put back enum just removed; it's screwing up existing code having all
...
the followers change.
2010-10-25 18:06:48 -07:00
Andy2
e909e4b343
remove redundant message; advance state to ALLCONNECTED on receipt of
...
RECONN or CONN that lists the game as full. This means we get the
all-green icon (or the A in the gtk case) when in a consummated game
rather than only when all devices are actually connected.
2010-10-23 20:29:24 -07:00
Eric House
8a038dc748
Merge branch 'relay_proxy' of ssh://xwords.git.sf.net/gitroot/xwords/xwords into relay_proxy
2010-10-23 19:45:03 -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
85d29cf560
if can't send allcond to a device because it's not connected queue the
...
message to be sent next time it does. And since the cookieID will
change and should be there already anyway, remove it. (Should remove
the hostID too for the same reason.)
2010-10-22 19:02:52 -07:00
Eric House
9ba2d2f177
default msgs entry timestamps to 'now'
2010-10-18 20:19:09 -07:00
Andy2
2bfb26cded
sleep (in thread) before closing proxy socket. This works around
...
problem where, on PRX_HAS_MSGS path only, device reading socket gets
EOF early though logging here confirms additional bytes have been
written. Gross but effective.
2010-10-17 06:38:28 -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
e5c7f476ba
get rid of microseconds in timestamps
2010-10-14 22:15:41 -07:00
Eric House
0d1542ca9d
tweaks to logging
2010-10-12 05:18:44 -07:00
relay
680b2f31b3
use pid to avoid permission problems for logfile in /tmp
2010-10-07 19:48:38 -07:00
Eric House
f2ad6d92b4
use full paths so pidof doesn't pick up instances of xwrelay launched elsewhere
2010-10-07 19:41:02 -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
a444786a28
reduce logging
2010-10-05 20:57:19 -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
Eric House
d9ca6f5e11
block TERM and INT from all but the main thread. (Pretty much untested; doesn't fix hang-on-SIGINT.)
2010-10-04 20:03:19 -07:00
Eric House
1ff4d67bc0
block TERM and INT from all but the main thread. (Pretty much untested; doesn't fix hang-on-SIGINT.)
2010-10-04 20:03:00 -07:00
Eric House
43bf3cd50f
improve log statement
2010-10-04 20:01:00 -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
1f87379cd0
change default port
2010-09-29 07:37:26 -07:00
Eric House
1b93654f7e
use stored procedure sum_array instead of C macro
2010-09-29 06:21:08 -07:00
eehouse@eehouse.org
d0797af6e5
Merge branch 'relay_proxy' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into relay_proxy
2010-09-28 21:11:17 -07:00
Andy2
978fa010f1
commented-out sleep positioned to give download progress time to come up.
2010-09-28 18:35:33 -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
f7bad05390
send msg count query and print results
2010-09-24 05:51:42 -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
c44324a32a
log, for now as I've seen assertions failures suggesting a race, the
...
set of checked-out sockets at insert and remove time.
2010-09-23 06:34:18 -07:00
Andy2
40e1d29243
use new methods to store undeliverable messages in a db rather than in
...
memory. Confirmed that devices can hookup without ever being
connected at the same time and that the messages survive a relay
reboot. No further testing yet.
2010-09-23 06:32:57 -07:00
Andy2
74764a493b
create the new db
2010-09-23 06:31:42 -07:00
Andy2
eee41377f4
new methods for storing/retrieving messages in new db.
2010-09-23 06:31:29 -07:00
Andy2
9a035c66ff
add assertion
2010-09-23 06:28:13 -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
1d0c207521
add test command for proxy feature to fetch for connNames whether
...
there are messages pending for them. Not handled yet on relay.
2010-09-21 18:28:31 -07:00
Andy2
e06baf566f
get public rooms from the db rather than stubbing it out.
2010-09-21 06:54:47 -07:00
Andy2
be23e06b60
use read_packet to replace duplicate code
2010-09-21 06:38:43 -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
2ec67c8ed1
finish rq to work with current format; add to makefile
2010-09-21 06:26:49 -07:00
Eric House
4ad735124c
add logging and assertions. There's a race condition in cref
...
recycling and may be one in tpool socket checking-out.
2010-09-20 22:11:13 -07:00
Eric House
047f41b516
send cookieid as part of [RE]CONNECT_RESPONSE in addition to ALL_COND (where it's now redundant).
2010-09-20 22:06:35 -07:00
Andy2
a549ade1fa
a bit more work on rc
2010-09-20 18:31:17 -07:00
Andy2
15cd3af62a
just a comment
2010-09-20 05:35:29 -07:00
Andy2
e1c99f53cd
work on detecting duplicate packets and devices that have reconnected
...
on a different socket; print all present seeds for debugging.
2010-09-20 05:35:19 -07:00
Andy2
ac8891016f
work on detecting duplicate packets and devices that have reconnected
...
on a different socket; print all present seeds for debugging.
2010-09-20 05:35:09 -07:00
Andy2
430b033ae0
a bit of progress on cmdline tool
2010-09-20 04:59:09 -07:00
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
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
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
50c387d75e
remove players from db as well as runtime when ack times out
2010-09-16 06:49:35 -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
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