Commit graph

4651 commits

Author SHA1 Message Date
Andy2
859283a8d0 save stateAfterShow as part of serialized game state. Fixes problem
where games with more than two devices would hang because server.c
code was dropping messages that comms.c code thought were good and so
ACK'd preventing them from being sent again.  They were being dropped
because the game was in the wrong state after displaying a move-made
dialog because the state it was to move to after doing that display
had not been saved.
2011-07-06 18:11:56 -07:00
Andy2
63799a5f4a add new error message to DEBUG-only printing code.
Conflicts:

	xwords4/common/comms.c
2011-07-06 18:10:42 -07:00
Andy2
a975a405aa handle new "no-connect-dead-game" error code the same as an in-play
"deleted" message: put up existing dialog offering to delete the game.
2011-07-06 06:50:56 -07:00
Andy2
9ec72d6015 handle new "no-connect-dead-game" error code the same as an in-play
"deleted" message: put up existing dialog offering to delete the game.
2011-07-06 06:49:19 -07:00
Andy2
f3ab40519d add new error message to DEBUG-only printing code. 2011-07-06 06:47:56 -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
4789bac85e add new mode that only launches games after the relay says there's a
message for them.  This is to mimic a common way games are played on
Android and to ensure that there are no points where that style of
play hangs because no device in the game will be "up".
2011-07-04 19:46:12 -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
Andy2
4b75174170 save stateAfterShow as part of serialized game state. Fixes problem
where games with more than two devices would hang because server.c
code was dropping messages that comms.c code thought were good and so
ACK'd preventing them from being sent again.  They were being dropped
because the game was in the wrong state after displaying a move-made
dialog because the state it was to move to after doing that display
had not been saved.
2011-07-04 12:51:00 -07:00
Andy2
0eec455119 change one return type; improve logging 2011-07-04 12:46:48 -07:00
Andy2
8904f37e1a force XW_STATE to be 1 byte. 2011-07-04 12:45:51 -07:00
Andy2
ab8e4e437b call server_do before passing message to server to give it a chance to
get any pending work done.
2011-07-04 12:37:23 -07:00
Andy2
66d42faead fix sync-with-relay menu items to work even if timed syncing is
disabled.
2011-07-04 12:28:17 -07:00
Andy2
7024718c87 add timestamps to jni logs 2011-07-04 09:38:22 -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
Eric House
e207e0e142 add option to run only one game at a time in a given room. The idea
was to mimic conditions that are creating a bug on-device but it
didn't work.  Still, a useful test case....
2011-07-02 23:12:16 -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
35bfdb1dd6 Merge branch 'android_invite' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into android_invite 2011-06-30 19:44:46 -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
5c5708fa66 try to fix race condition that sometimes means script detects game is
over but doesn't communicate to relay: don't consider file done until
have info to sent to relay.
2011-06-30 19:37:37 -07:00
eehouse@eehouse.org
3db7fccb53 Merge branch 'android_invite' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into android_invite 2011-06-30 18:57:53 -07:00
Andy2
ada84cccb3 make invites work with games having more than two players. But: the
games themselves don't work!  Fix this or disable 3- and 4-device
networked games.
2011-06-30 18:56:51 -07:00
Andy2
36287870d4 add np (num players) param 2011-06-30 18:22:42 -07:00
Andy2
546791d215 custom message when more than one player missing reminding to invite
more than one person.
2011-06-30 06:30:05 -07:00
Andy2
0c42da905a plug memory leak flushed out by auto-juggle code: null dict doesn't
mean the end of the list.
2011-06-29 21:43:50 -07:00
Eric House
48ea9e2b28 add preference to juggle players when creating a new game
Conflicts:

	xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CurGameInfo.java
2011-06-29 21:43:44 -07:00
Eric House
ef9d359ab9 tweak default param values 2011-06-29 21:38:54 -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
4cb45d3b82 juggle before setting language (makes sense though not demonstrable
difference)
2011-06-29 18:30:08 -07:00
Andy2
cd844a5bad plug memory leak flushed out by auto-juggle code: null dict doesn't
mean the end of the list.
2011-06-29 18:28:55 -07:00
Andy2
632980dc98 add preference to juggle players when creating a new game 2011-06-29 06:16:58 -07:00
Andy2
413b2f5b2e include default language in text in new game dialog. 2011-06-28 19:01:03 -07:00
Andy2
5dd524ef2f param name for clarity 2011-06-28 19:00:21 -07:00
Andy2
a9d1dc7bdc add default room name in configure-first case too. 2011-06-28 18:32:32 -07:00
Andy2
363acc228a use printf so rooms sort numerically 2011-06-28 17:38:59 -07:00
Andy2
b2a7acbdf1 remove echo 2011-06-27 18:59:36 -07:00
Andy2
3db0543994 work in absence of drop-nth-packet param 2011-06-27 18:57:27 -07:00
Andy2
ceeee39c2d fold it what can from android_invite branch to make relay upgrade test
easier
2011-06-27 18:43:42 -07:00
Andy2
8673c6a001 toward being able to verify that upgrading the relay won't hurt
in-play games: add ability to pick up games mid-play; don't sleep
before killing a device unless it's only been running less that the
minimum.
2011-06-27 18:32:30 -07:00
Andy2
a96dfb57f6 drop-packet test got an assert because we assumed the effects of a
dropped packet.  Instead, now treat the connection as broken and
restart.
2011-06-27 18:30:52 -07:00
Andy2
e122953fd5 clean up logging 2011-06-27 18:27:07 -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
e44ed96691 fix logging: calling read(), not recv() 2011-06-24 18:28:18 -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
a5bab1232f deal with changing connnames: use the last 2011-06-23 18:12:38 -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
b4381e8403 drop-packets off, not on, by default 2011-06-22 18:17:47 -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
c87df3ce16 add option to drop incoming packets randomly (rather than 1st, then
2nd, then 3rd etc.)
2011-06-20 18:55:57 -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
9b4034f409 fix undefined variable by updating script before possibly deleting it 2011-06-16 18:35:08 -07:00
Andy2
7eb099d3a6 show seeds 2011-06-15 06:49:32 -07:00
Andy2
3f7cd851f2 use new drop-nth-packet option, incrementing by 1 each time.
Currently this breaks the relay -- which must be fixed.
2011-06-15 06:49:15 -07:00
Andy2
2d7a1f13b8 add drop-nth-packet option 2011-06-15 06:47:08 -07:00
Andy2
cb5fa56a90 Tweak a couple of messages. Bye Luke! 2011-06-14 06:40:10 -07:00
Andy2
ecc5211791 Bug: don't refuse to update preference summary just because it's empty. 2011-06-14 06:16:11 -07:00
Eric House
5fc430c6da Merge branch 'android_invite' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into android_invite 2011-06-14 05:47:16 -07:00
Eric House
cb3e33ef72 update for months-old param name changes 2011-06-14 05:46:27 -07:00
Andy2
7a5549cc43 set selectAllOnFocus on player name edit. Can't figure out how to
force focus to that field though....
2011-06-14 05:38:37 -07:00
Andy2
d470a1c1e0 add a newbie-info for new-from menuitem. Still need one for reset. 2011-06-13 18:47:42 -07:00
Andy2
a318021308 title that won't surprise on upgrade 2011-06-13 18:26:12 -07:00
Andy2
d18ac741b7 add new debug pref for redirecting host so it and relay can live on
different machines.
2011-06-13 18:17:37 -07:00
Andy2
c9c470b724 remove logging 2011-06-13 06:27:55 -07:00
Andy2
5232186b1d path starts with //, not / 2011-06-13 05:28:06 -07:00
Andy2
dfc8519c9c wrap password query field in layout too so it can have some margins. 2011-06-11 06:06:42 -07:00
Andy2
e9e8211050 capitalize names in player config too 2011-06-11 06:06:03 -07:00
Andy2
6620b42abd clean up new game dialog (thanks K.T.!): remove title bar, add some
spacing and make it scrollable for when in landscape mode.
2011-06-10 22:51:54 -07:00
Andy2
8c65ed5548 have default name text selected for easier replacement 2011-06-10 22:28:49 -07:00
Andy2
bb82831fb4 put EditText into a layout so can have some margins. 2011-06-10 20:55:18 -07:00
Andy2
1a89ed1f14 use new Utils.inflate where appropriate 2011-06-10 20:09:38 -07:00
Andy2
d058e3fd4b use a layout instead of a raw text widgit. 2011-06-10 20:02:14 -07:00
Andy2
1cc2717d50 tweak text for consistency 2011-06-10 20:01:22 -07:00
Andy2
a7851f3c55 on initial startup check if the default name's been set for Player 1.
If not, give a chance to set it and a welcome message.  Whatever
happens, wind up with some sort of default name so the query isn't
repeated unless user clears all defaults.
2011-06-10 18:58:49 -07:00
Andy2
1d5cfd49fa remove second URL that was meant to allow user to install Crosswords
if it's not installed (because SMS apps confuses with the way it
presents multiple URLs.)  Will try to do the same thing with the
redirect .php script whose output will stick around if the redirect
fails.  Also, use URI.Builder instead of a format string to build the
redirect URL.  It's cleaner.  Still need to have a space in the format
string to keep sentence-finishing period from becoming part of the
room name.  Not sure how to fix that without moving to html messages
which I assume don't work in SMS.
2011-06-10 06:49:32 -07:00
Andy2
d089c29ada factor uri parsing and creating code into its own class -- in case
there are matching operations required.  I thought one would be for
URLEncoder.encode() but seems not to be: spaces are un-escaped just
fine.
2011-06-09 20:56:29 -07:00
Eric House
dd97a81191 make constant string a static final rather than a resource. 2011-06-09 20:48:06 -07:00
Eric House
265ebc5e3e add download url in csse redir fails 2011-06-09 18:30:59 -07:00
Andy2
6c4f35b425 wrap parsing of new-game URI in a try so don't crash when they're
badly formatted.
2011-06-09 06:49:55 -07:00
Andy2
e097b15071 room names are user-created and need to be URLEncoded to e.g. escape
spaces.
2011-06-09 06:38:43 -07:00