Commit graph

3762 commits

Author SHA1 Message Date
eehouse@eehouse.org
5d9989eb1b Merge branch 'relay_proxy' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into relay_proxy 2010-10-16 10:50:23 -07:00
Andy2
a82051739b move interface; add some logging. 2010-10-16 10:49:25 -07:00
Andy2
91e95eb48b fix string (which should not be hard-coded!) and use new class. 2010-10-16 10:48:59 -07:00
Andy2
02ea8b13e0 move this functionality into RelayReceiver 2010-10-16 08:08:12 -07:00
Andy2
737b146093 Receiver replaces Activity as target of alarms. This seems to prevent
flasing to the front when alarms fire which was causing all kinds of
grief.  But: not yet tested on device.
2010-10-16 08:07:48 -07:00
Andy2
cd1ce339ed fix off-by-one error in reading from cursor 2010-10-16 07:57:47 -07:00
Eric House
38ae2faacc don't nuke bad files along with good 2010-10-14 22:17:34 -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
c92d59fa53 games can be started with multiple dicts; saving of successful games/logs optional 2010-10-14 05:59:45 -07:00
Eric House
f246178b8f Merge branch 'relay_proxy' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into relay_proxy 2010-10-12 19:18:21 -07:00
Eric House
40a7a1b5a3 cleanup; track checked rooms rather than checking each time seen 2010-10-12 19:17:42 -07:00
Eric House
0cf94dda8b fix frequent assertion failure that dates from when no messages passed
outside of ALLCOND state.  With this fix the test script is running
all games to completion if given enough time.
2010-10-12 19:16:46 -07:00
Andy2
a52c18522c use HashSet rather than relying on nesting (which I can't) to track
whether I'm running
2010-10-12 18:53:19 -07:00
Andy2
34428b3460 new Activity class 2010-10-12 18:28:05 -07:00
Andy2
82d5f21d54 extend subclass of Activity or ListActivity 2010-10-12 18:27:50 -07:00
Andy2
c37ad2d650 register self with RelayService to be called directly if running when
there's something to update.  Use handler to do this from non-UI thread.
2010-10-12 18:27:13 -07:00
Andy2
8e8c4f4d31 if GamesList is frontmost when we have relayIDs to update then just
call the interface it's registered.  Otherwise post notification.
2010-10-12 18:25:29 -07:00
Andy2
ad9a249042 new files. Subclass Activity and ListActivity to track whether we're
running (yeah, WTF, but that's what Android dev support says you have
to do!).  Special-purpose Activity to be the target of notifications
so I have more control on how to handle them.
2010-10-12 18:21:18 -07:00
Andy2
673c9858cb fire every 30 for testing 2010-10-12 05:24:23 -07:00
eehouse@eehouse.org
ddb8f508f9 Merge branch 'relay_proxy' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into relay_proxy 2010-10-12 05:23:04 -07:00
Eric House
0d1542ca9d tweaks to logging 2010-10-12 05:18:44 -07:00
Eric House
8011eeec2c cleanup; fix off-by-one bug with NAMES that was breaking runs with
four-device games; check before run that there aren't already waiting
games in db.
2010-10-12 05:17:32 -07:00
Andy2
b124a3f438 add every-five-minutes option; change 10-seconds debug option to 60 2010-10-11 06:54:02 -07:00
Andy2
392aeff7ad replace FLAG_ONE_SHOT with FLAG_UPDATE_CURRENT; seems to fix failure
of notification to fire.
2010-10-11 06:52:26 -07:00
Andy2
86b57526df show game name in title if not hidden 2010-10-11 06:47:33 -07:00
Andy2
e637a64d96 Change param signage to fix compiler warning 2010-10-11 06:20:30 -07:00
Andy2
56cd161d8b Pass list of relayIDs through activity to onNewActivity() added to
GamesList, and inval those list elements that now have messages
pending so they redraw.  And add static method to be called from there
to cancel the status-bar notification now that it's been acted on.
2010-10-09 21:44:42 -07:00
Andy2
6ad074182f make GamesList singleTop so notifications go to existing activity 2010-10-08 17:33:44 -07:00
Andy2
7d9c143d15 string doesn't need localizing 2010-10-08 17:32:51 -07:00
Andy2
76258f609a make sure game is still over before calculating final scores. Fixes
assertion failure in server.c.
2010-10-08 17:30:26 -07:00
Andy2
97d96add5e add stubbed-out strings 2010-10-08 06:53:41 -07:00
Andy2
e855b51491 use new DB api to build list of relayIDs to send; set summary DB field
and post notification on response.
2010-10-08 06:52:43 -07:00
Andy2
3bbbd65077 use same 1.5-safe layout on all devices; add elem (a text field for
now) to be shown when messages are pending; show it.
2010-10-08 06:47:46 -07:00
Andy2
6ce5f36133 add msgsPending field set from new DB column; add methods to set
column and to fetch relayIDs for games where it's not set, and to get
path for game based on relayID.
2010-10-08 06:46:10 -07:00
Andy2
d5eff5af21 new column to track whether game has pending msgs 2010-10-08 06:42:51 -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
eehouse@eehouse.org
46ff3c3b68 Merge branch 'relay_proxy' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into relay_proxy 2010-10-06 05:22:10 -07:00
Andy2
cb4092bb39 make relayID a String rather than a byte[]; log result of pending
messages query to confirm working.
2010-10-06 05:21:19 -07:00
Eric House
6c5b279946 respect TIMEOUT, and kill all remaining processes before exiting 2010-10-05 20:58:29 -07:00
Eric House
a444786a28 reduce logging 2010-10-05 20:57:19 -07:00
Eric House
f0b05da131 reduce logging 2010-10-05 20:57:07 -07:00
Andy2
a78c4b304e custom class for pref 2010-10-05 18:39:00 -07:00
Andy2
df939249e4 fix caps and add too-long string 2010-10-05 18:38:46 -07:00
Andy2
861de8d592 call new method to start polling timer 2010-10-05 18:38:06 -07:00
Andy2
81fb934e4a new custom class for resetting polling timer on prefs change 2010-10-05 18:36:56 -07:00
Andy2
cd0d14b1bb new class will own setting summary for relay-polling frequency so don't do it here 2010-10-05 18:36:15 -07:00
Andy2
ae6edf4ace add static methods for starting timer. 2010-10-05 18:35:35 -07:00
Andy2
ed95d2e794 add proxy port to list whose values are displayed 2010-10-05 06:17:35 -07:00
Andy2
31f3cbc6c8 complete rewrite: use bash's new associative arrays to track games and
pids etc. so that a single process can manage starting and stopping
all games.  Fixes race conditions where a game would be killed after
finishing but before it'd sent out the message that would allow other
games to finish.
2010-10-04 22:16:58 -07:00
Andy2
a13bb34419 plug memory leak 2010-10-04 22:14:44 -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
fae8faa0be add stubbed-out Reply button to msg received dialog. 2010-10-04 18:59:44 -07:00
Andy2
1ed8e7a66c fix crash: can't call dialog from non-UI thread 2010-10-04 18:53:33 -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
b3c7cb3711 start on sending chat messages. Doesn't even compile -- committing to get onto another machine. 2010-10-04 05:38:05 -07:00
Eric House
1e13e92deb support for receiving and displaying chat messages. Compiles but not tested. 2010-10-03 18:32:39 -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
14fd1f9023 add test code for chat feature: display incoming chat and send via
menu.  Sent message is hard-coded for now; should fix that.
2010-10-03 18:13:48 -07:00
Eric House
61b228f189 implement simple chat on top of current server-level protocol --
meaning it'll work on any tranport but relay doesn't know about it.
(If relay knew about it I could send a "shutting down for a minute"
message to every connected device, which would be cool.  But this is
easier.)  Written, BTW, enroute from Seattle with help from beer from
Chris in first class. :-)
2010-10-03 18:11:51 -07:00
Eric House
4a5de0a24c cleanup 2010-10-03 18:09: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
f78b1747dd put up an alert when unable to find any public rooms 2010-09-28 18:58:05 -07:00
Andy2
0bfad7cd05 up timeout to 15 seconds. 2010-09-28 18:42:23 -07:00
Andy2
2610ef34ac move dict above connection settings since it provides a parameter 2010-09-28 18:38:47 -07:00
Andy2
978fa010f1 commented-out sleep positioned to give download progress time to come up. 2010-09-28 18:35:33 -07:00
Andy2
814f6887da put up a progress dialog while fetching public names that mentions
params passed.
2010-09-28 18:34:29 -07:00
Andy2
0b143efced add getLangName 2010-09-28 18:33:29 -07:00
Andy2
6b1dabd8e2 don't crash when public rooms list is empty 2010-09-28 18:32:43 -07:00
Eric House
bc65377cfd track device seeds in db. 2010-09-28 18:06:50 -07:00
Eric House
a6f5ea5f4a sync after saving. Seems to improve recovery from TERMs sent by test scripts. 2010-09-28 18:06:05 -07:00
Eric House
a89520a377 use __func__ 2010-09-28 18:04:31 -07:00
Andy2
953e4601b9 fetch public rooms using new class rather than hardcoding. With this
checkin game is possible based on public-room lookup.
2010-09-28 06:48:51 -07:00
Andy2
132321c9fd new AsyncTask subclass to fetch public rooms list from relay 2010-09-28 06:47:58 -07:00
Andy2
89d20578b8 new class to create socket for talking to proxy 2010-09-28 06:47:21 -07:00
Andy2
39827ec894 add new pref for relay's proxy/device port 2010-09-28 06:43:04 -07:00
Andy2
1de029f3f0 skip public rooms if full. (Should do this in the query....) 2010-09-28 06:42:01 -07:00
eehouse@eehouse.org
ac74cc36a5 Merge branch 'relay_proxy' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into relay_proxy 2010-09-26 20:25:30 -07:00
Andy2
986ac4413f parse reply to query for number of pending messages for games on
device.  Not doing anything with the info yet.
2010-09-26 20:25:00 -07:00
Eric House
ae53ce5ea9 Merge branch 'relay_proxy' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into relay_proxy 2010-09-24 20:19:50 -07:00
Eric House
1bfdd1978e move log directory away each time 2010-09-24 20:19:12 -07:00
Eric House
8f77886f72 make column name shorter 2010-09-24 20:18:20 -07:00
Andy2
14edbd7f18 implement setIsServer(). With this change I've been successful --
once -- having two games on the same device play against each other.
2010-09-24 18:49:34 -07:00
Andy2
31c594a06e everybody starts out as client by default, same as on linux 2010-09-24 18:48:52 -07:00
Andy2
63ac6542c6 add new action to be called when relay make me a client. Seems
necessary to get server_initClientConnection connection called when
all's in the right state.  It's not working consistently yet, though,
so may need changes.
2010-09-24 18:48:30 -07:00
Andy2
16001e61d0 image forgotten earlier -- for refresh public games list button 2010-09-24 18:46:14 -07:00
Andy2
4ea9ff8226 add server_reset and util_setIsServer to jni 2010-09-24 18:45:42 -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
35ff5a7835 exit on logdir being gone before grepping it 2010-09-23 06:41:37 -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