Commit graph

419 commits

Author SHA1 Message Date
Eric House
421e2a4ae3 fix uninitialized variable 2011-07-08 05:53:08 -07:00
eehouse@eehouse.org
ba4d898de1 Merge branch 'android_invite' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into android_invite 2011-07-06 19:12:16 -07:00
Andy2
86e3cc7286 When device reconnects to a dead game, just deny the connection with a
new error message rather than allow it as if it were a normal game
only to send a game-dead message after.  This solves the problem of
how device knows not to put up welcoming message or suggestion to
invite to a game that's suddenly missing players.  BUT: this change is
incompatible with existing versions and so needs to get pushed out
before the in-use relay can be upgraded to include this code.
2011-07-06 06:47:25 -07:00
Andy2
928404be50 remove unused enum 2011-07-06 06:15:25 -07:00
Eric House
a3dbde9b88 more dealing with edge cases. 2011-07-05 21:42:03 -07:00
Eric House
98a65d82ed fix crash in rare edge case 2011-07-05 21:40:13 -07:00
Eric House
d3108aac79 split method in two to provide new API (I'm not using yet) 2011-07-05 21:39:38 -07:00
Andy2
999d4c11e7 simple script for watching what messages the relay has pending for a
game.
2011-07-04 12:51:27 -07:00
eehouse@eehouse.org
8f782070ac Merge branch 'android_invite' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into android_invite 2011-07-03 09:28:36 -07:00
Andy2
175aace629 fix a couple of rare failures due to race conditions testing or
valgrind flushed out.
2011-07-02 13:28:24 -07:00
Eric House
09b81c6ad7 fix rare crash: don't call PQgetvalue when there are no results. 2011-06-30 19:39:00 -07:00
Eric House
b4a513ce87 reduce logging; log errno on syscall failure 2011-06-29 21:38:31 -07:00
Eric House
8e31fd88c3 reduce logging; and fix valgrind-found problem using wrong
synchronization primative.
2011-06-29 21:37:33 -07:00
Eric House
04740486fb wrap more logging in ifdefs 2011-06-29 21:35:21 -07:00
Eric House
2b4f439a2f rough script to parse logs looking for threads that have hung (stopped logging) 2011-06-29 21:32:18 -07:00
Andy2
57cfefb6a9 fix leaks -- that don't really matter as process is exiting, but
quiets valgrind.
2011-06-29 18:45:02 -07:00
Andy2
f3a4ff9dfc use cid for variables of type CookieID everywhere instead of almost
everywhere
2011-06-29 18:42:41 -07:00
Andy2
c84722fc22 add ack 2011-06-27 06:45:14 -07:00
Andy2
fffcbb677e under testing I'm running up against the 1024-files-open limit and
dying with an assert.  Log something -- but still die as there's
nothing to be done in code except hope some connections don't
reconnect right away.  Fixes: 'ulimit -n' or edit 'nofile' param in
/etc/security/limits.conf on the relay host.
2011-06-27 06:20:51 -07:00
Andy2
c2cd3a709a specify name of database in config file rather than hard-coding it. 2011-06-25 21:32:18 -07:00
Andy2
ffeb94e4bd start getting rid of super-verbose logging 2011-06-25 21:30:32 -07:00
Andy2
cdc16ee974 variable/method name change only: cookieid->cid 2011-06-25 15:43:52 -07:00
Andy2
38ad3aa81c cleanup; and: collapse HostRec and socket set into map of socket to
HostRec, protecting all accesses with ReadWrite locks.
2011-06-25 15:40:12 -07:00
Andy2
6c121dac57 final set of changes -- all test cases now seem to be passing. Stop
duplicating set of sockets owned by a cref, moving it from cinfo into
cref and caching a copy outside when cref is unclaimed (after which no
change is possible until it's claimed again.)
2011-06-24 18:34:34 -07:00
Andy2
df60ec648b Don't return new error XWRELAY_ERROR_NORECONN as devices don't have it
yet.
2011-06-24 18:32:53 -07:00
Andy2
9ff149fe2d fix race: if we get a cid from the DB while another thread has claimed
that cid, then by the time we can claim it there's no longer space for
us.  Call new method after the claim succeeds to make sure there's
still room, and if not relinquish and loop back to the DB for another
try.
2011-06-23 19:00:32 -07:00
Andy2
c51e5e41f4 fix ClaimSocket: it was neither marking claims nor checking for marks. 2011-06-23 18:58:50 -07:00
Andy2
63a4e6c953 get rid of per-cref mutex: it's redundant now that access is
synchronized.  Add method to check if new players are still welcome to
allow fix for race.
2011-06-23 18:57:48 -07:00
Andy2
e886a1aefe lots more changes -- another snapshot, this, rather than stuff
carefully polished and reviewed.  Shows progress, though, in getting
through tests.
2011-06-23 07:12:50 -07:00
Andy2
3ebcc01e86 beginning -- this is a snapshot -- of rewrite of how relay keeps
multiple thread out of a single game.  Add new class that locks
per-cid and start using it.  Very incomplete.
2011-06-22 06:51:26 -07:00
Andy2
aecdd8922f don't show times -- not interesting for debugging right now 2011-06-20 18:55:17 -07:00
Eric House
85d484a881 major mod to deal with devices that fail to receive ACK and then
reconnect.  I was putting both (i.e. the same device twice) in the
same game.  Now I detect this based on the seed being duplicated and
treat the device as having failed to ACK then proceed with the CONNECT
as if it were new.  Tested pretty heavily but only with two-device
games.
2011-06-20 18:13:15 -07:00
Eric House
44af266db6 add logging 2011-06-20 18:10:42 -07:00
Eric House
238fac3696 add new ack column to track whether devices have ACKd yet. 2011-06-20 18:10:07 -07:00
Andy2
7eb099d3a6 show seeds 2011-06-15 06:49:32 -07:00
eehouse@eehouse.org
32143d8116 Merge branch 'android_branch' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into android_branch 2011-03-31 18:19:31 -07:00
Andy2
9f76bdede9 hold mutex for slightly shorter time 2011-03-31 18:16:56 -07:00
Eric House
27346cf58b change AIP to remove several stored messages at a time. Will use
later to delete messages after proxy fetches and ACKs them so traffic
isn't repeated.
2011-03-31 18:15:03 -07:00
Eric House
7aeb0a4df0 make default socket timeout 5 seconds, not 20. 2011-03-31 18:13:16 -07:00
Andy2
cd4ddd5dbb fix help 2011-03-31 06:41:39 -07:00
Andy2
8bb2857e63 The relay is hanging inside recv(). Use setsockopt to set a 20-second
receive (and send) timeout on all sockets accept() returns.  Sockets
that timeout should then get closed and dropped.
2011-03-12 05:13:54 -08:00
Eric House
e196cfb352 add state table entry lack of which caused a bunch of crashes in a
short time on the live relay.  I'm not sure why it's needed, why they
happened only this time (likely due to a single device) or
alternatively why I don't see those crashes in testing, but the
addition doesn't break anything.
2011-02-04 05:41:44 -08:00
Eric House
dc82e57f14 add ability to fetch messages for more than one game at a time 2011-01-27 21:08:17 -08:00
Andy2
57ec020330 change format of reply to MSG_GET: include number of messages per
device to support fetching for more than one at once.  This is
meaningless for rq as written now but a device will want to do this.
2011-01-27 06:37:36 -08:00
Eric House
63d16a99a2 turn off http view 2011-01-24 22:20:01 -08:00
Andy2
42d1a713c9 add new -f flag to invoke new fetch-message proxy command. Write the
results to stdout in stream format (len + message).  Goal is to be
able to pipe output to the linux clients to test.
2011-01-22 12:54:47 -08:00
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
725888cb6c run proxy sockets through same thread pool as game sockets. This
prevents race conditions that are turning up when I'm running multiple
threads -- by allowing me to really not be running multiple threads.
Tested with the usual script.
2011-01-20 18:14:56 -08:00
Andy2
b506673946 use only one thread until race condition's fixed 2011-01-19 18:36:50 -08:00