Commit graph

10433 commits

Author SHA1 Message Date
Eric House
bda545fc8e comment out iface
On Linode anyway the relay's unreachable from python scripts unless I do
this, and it seems harmless in local tests too.
2017-12-14 06:39:40 -08:00
Eric House
e96a982f24 get rid of moved file already 2017-12-12 06:59:31 -08:00
Bernard Massot
70aeef6c8e Translated using Weblate (French)
Currently translated at 99.1% (737 of 743 strings)
2017-12-11 17:46:23 +01:00
Eric House
ddadee9bef copy in changes from dev branch 2017-12-11 07:09:44 -08:00
Eric House
4746f153e3 add assertion
Need to revisit that join() call; this'll help.
2017-12-11 06:56:53 -08:00
Eric House
4fa8079bf0 log outgoing "post" params json 2017-12-11 06:55:25 -08:00
Eric House
d1a5a94740 fix crash processing multiple packets
When grouping to allow multiple packets per outbound API call I forgot
that some are there to mark the end-of-queue: can't be sent! Trying
caused a NPE. Now if any EOQ is found in the queue that batch is dropped
and the thread's exited.
2017-12-11 06:42:35 -08:00
Eric House
701e6968de file to pull an apk
app-id is hardcoded for now.
2017-12-10 11:56:52 -08:00
Eric House
fc4e577f1b bring changes over from dev branch
old tests pass without any socket leakage
2017-12-10 08:21:22 -08:00
Eric House
2e71aedc02 fix --game-dict option 2017-12-09 21:32:05 -08:00
Eric House
8d10dca23e pull in test scripts from dev branch 2017-12-09 20:39:16 -08:00
Eric House
afda9ce446 add assertion 2017-12-09 13:30:25 -08:00
Eric House
530e0181e5 list open sockets 2017-12-09 13:30:08 -08:00
Eric House
811c8f535e add socket refcounting
AddrInfo now has ref()/unref() and keeps a global socket->refcount map
(since actual AddrInfo instances come and go.) When the
count drops to 0, the existing CloseSocket() method is called. This
seems to fix a bunch of race conditions that had a socket being closed
and reused while old code was still expecting to write to the device
attached to the socket the first time (along with lots of calls to close()
already-closed sockets, attempts to write() to closed sockets, etc.)
2017-12-07 07:18:09 -08:00
Eric House
dbf38f7759 don't use mlock in config; don't close socket
Use of mutex logging recurses infinitely if config uses mlock, so remove
that. And don't free sockets after handling their messages as they may
be in use elsewhere. This likely introduces a leak of sockets.
2017-12-06 19:11:32 -08:00
Eric House
243eb213bb make reply messages a param within result
Makes it easier to debug by adding stuff on the relay end
2017-12-06 18:57:48 -08:00
Eric House
70dea02efc cleanup; fix possible socket drop
Haven't seen it happen, but I think there was a bug that could have led
to all the sockets coming back as ready from poll() being dropped. Fixed
that and added/cleaned up some logging.
2017-12-04 20:40:44 -08:00
Eric House
d5c4ecabce rename class; add some logging
Rename class that's no longer just about UDP as it began. Add a bit of
logging. This commit *should* not change behavior at all.
2017-12-03 19:18:36 -08:00
Eric House
fd5549014a fix logging 2017-12-03 18:52:06 -08:00
Eric House
17d3f14d9e kill script when no change for two minutes
by default -- there's a flag for that too.
2017-12-03 17:05:02 -08:00
Eric House
e485af925f log milliseconds: seconds not enough. 2017-12-03 16:07:30 -08:00
Weblate
6ffd4d4a37 Merge remote-tracking branch 'origin/android_translate' into android_translate 2017-12-01 04:25:46 +01:00
Eric House
45bb36e66c pad log and db file names for better sorting 2017-11-30 07:43:04 -08:00
Eric House
f1b91f4df2 exit if tile line hasn't change in 2 minutes 2017-11-29 20:39:15 -08:00
Eric House
12ab4bdc5c print total runtime on exit 2017-11-29 20:02:27 -08:00
Eric House
db0d5ef746 tweak display; add signal handler for clean shutdown 2017-11-29 19:32:27 -08:00
Eric House
f9c92ca34f tweak device-in-game summary
Group devices by game so connectivity is easier to watch.
2017-11-28 07:08:41 -08:00
Eric House
4b81b784fc Merge branch 'android_branch' into relay_via_http 2017-11-28 06:24:09 -08:00
Eric House
8e37551f8a up changelog for new release 2017-11-27 20:40:16 -08:00
Eric House
455373343a remove requirement for gcm.jar
remove from xw4d version too since it can't work anyway.
2017-11-27 20:40:16 -08:00
Eric House
af81342021 create new fdroid variant 2017-11-27 20:40:06 -08:00
Eric House
503702c0e4 log unack'd packets 2017-11-26 20:56:38 -08:00
Eric House
0d8aef06f3 keep packets until ack'd for retry and better logging 2017-11-26 20:11:25 -08:00
Allan Nordhøy
9572cdca1b Translated using Weblate (Norwegian Bokmål)
Currently translated at 55.6% (411 of 738 strings)
2017-11-26 15:49:40 +01:00
Eric House
58eafd5fd1 fix glitches in XML strings for Norwegian 2017-11-20 22:04:42 -08:00
Eric House
3216ef8a5c Merge branch 'android_branch' into android_translate 2017-11-20 06:53:34 -08:00
Eric House
b6124ca2d1 change version strings and changelog 2017-11-19 20:10:54 -08:00
Eric House
4698c0e54b add not-again explanation for new archive feature 2017-11-19 20:00:45 -08:00
Eric House
039dcdf0cc print how long run has left 2017-11-19 19:40:29 -08:00
Eric House
ae98425c21 output game progress as a table 2017-11-17 08:06:23 -08:00
Eric House
e7d00cbad4 fix TIMEOUT calculation 2017-11-16 08:29:22 -08:00
Eric House
5ff6f2ca22 fix TIMEOUT calculation 2017-11-16 08:27:51 -08:00
Eric House
ba9b94a0c6 move g_free after last use of ptr
(Made same on another branch but couldn't cherry-pick)
2017-11-16 08:18:39 -08:00
Eric House
f45dcb36b1 rewrite of shell script in python3
translate the most-used features of my too-big-for-bash script into python3,
which is clearly much better suited. Tried to keep the structure and variable
names intact so that diff has a chance of showing something, but when a class
replaces a bunch of arrays that were being kept in sync there's only so much
you can to. Currently doesn't support stuff like app upgrades and switching
from tcp to udp, but those should be relatively easy to bring over from the
.sh when/if I need them.
2017-11-16 08:15:06 -08:00
Eric House
9d02237f19 add assertion to catch too many players 2017-11-16 08:14:49 -08:00
Eric House
236124319a rewrite of shell script in python3
translate the most-used features of my too-big-for-bash script into python3,
which is clearly much better suited. Tried to keep the structure and variable
names intact so that diff has a chance of showing something, but when a class
replaces a bunch of arrays that were being kept in sync there's only so much
you can to. Currently doesn't support stuff like app upgrades and switching
from tcp to udp, but those should be relatively easy to bring over from the
.sh when/if I need them.
2017-11-16 08:04:18 -08:00
Eric House
8b4042a082 add assertion to catch too many players 2017-11-16 07:59:06 -08:00
Eric House
768b63df24 move free() after last use of ptr 2017-11-15 05:48:45 -08:00
Allan Nordhøy
e6a1aef7a2 Translated using Weblate (Norwegian Bokmål)
Currently translated at 11.6% (86 of 738 strings)
2017-11-14 06:48:41 +01:00
Eric House
2879055ca9 log url when response code isn't 200 2017-11-13 08:17:26 -08:00
Eric House
8d99ddee7d Merge remote-tracking branch 'maidu2/relay_via_http' into relay_via_http
(Will probably never use this file...)
2017-11-13 07:30:28 -08:00
Eric House
5166933be6 Merge branch 'android_branch' into relay_via_http 2017-11-13 07:27:17 -08:00
Eric House
033ceab9d1 log outgoing params 2017-11-13 07:26:47 -08:00
Eric House
607567cd35 don't allow duplicate group names
If group already exists, warn rather than create another with the same
name.
2017-11-12 22:50:45 -08:00
Eric House
c2eff7d3f2 add "archive" option to dialog on opening done game
Create the group if needed. Name's not user-editable at this
point. Should be a preference, and that preference should be changed if
user renames it.
2017-11-12 22:31:48 -08:00
Eric House
b77ea0aaad copied from relay_via_http branch
(was at: ./xwords4/android/scripts/relay.py) This is the web API clients
can use to talk to the relay.
2017-11-12 20:29:15 -08:00
Eric House
f072c68bf9 bring in changes from relay_via_http branch
It's time to make them live so client development can use a live relay,
and all the old tests pass, so why not.
2017-11-12 20:25:29 -08:00
Eric House
35d172225f Use AtomicInteger rather than synchronization 2017-11-12 20:10:51 -08:00
Eric House
373c0249bc start backoff timer at 5 second, not 30.
Makes the http case nearly as quick as the udp one when both games are
on the same device. Which is all I've tested so far.
2017-11-12 20:04:22 -08:00
Eric House
fb4f44b0fc remove mistaken assert
I'm not quite sure why it was firing, but the pattern of a FindGame
failing due to a race condition and requiring a retry exists elsewhere
in the code. Lots of tests pass once this change is made. :-)
2017-11-12 19:59:20 -08:00
Eric House
8650795a81 don't crash when can't reach relay via http 2017-11-12 08:53:19 -08:00
Eric House
ec075eff18 comment out assertion that's firing when db wiped 2017-11-11 18:49:23 -08:00
Eric House
5bd71ba7c5 put cids back into the database
The hack I came up with for storing them in memory isn't working. Even
if it's just that I don't understand C++ maps they need to be cleared
when the DB's wiped (my favorite test these days) and I don't want to
spend the time now.
2017-11-11 18:46:02 -08:00
Eric House
057728c287 make gtk include an invite ID in rematch invitations
otherwise Android refuses to accept the second "" it receives.
2017-11-11 16:39:09 -08:00
Eric House
cb87a849ab rename dict symlink
It breaks rematch that "dict" is being passed to the Android client from
the linux side, and this is easier than figuring out how and when to
dereference the link.
2017-11-11 16:12:06 -08:00
Eric House
fa52c5091a fix tap down lower not opening game
Making the right_side elem match its parent height prevents the
lower-right region of game list items from falling through and
triggering a toggle-selection event.
2017-11-11 15:45:00 -08:00
Eric House
39deeeb089 fix tap down lower not opening game
Making the right_side elem match its parent height prevents the
lower-right region of game list items from falling through and
triggering a toggle-selection event.
2017-11-11 15:43:07 -08:00
Eric House
3da5f237c6 add asserts to catch non-web holdouts; don't crash
Getting nulls when e.g. the relay isn't up. Shouldn't crash in that
case.
2017-11-11 15:31:36 -08:00
Eric House
bd4ddb0adf name change 2017-11-11 15:26:09 -08:00
Eric House
878875dd34 revert DB changes -- don't need 'em now
It'll be a lot easier moving the relay forward if I can not change the
DB.
2017-11-11 13:26:44 -08:00
Eric House
c2d5f2d253 cleanup 2017-11-11 13:05:25 -08:00
Eric House
e2c6480992 fix linux client
everything takes one param now, and post sends an array
2017-11-11 12:57:33 -08:00
Eric House
f428538afc send an array of packets to post()
Somethimes there are several on the queue, so why not send all at
once. Note: this will break the linux implementation which I'll fix next.
2017-11-11 10:47:26 -08:00
Eric House
b9800b22f5 RelayService uses web instead of UDP!
As expected, moves are no longer received instantly because the UDP
socket isn't available for the relay to write too once the URL
handler (relay.py) finishes.
2017-11-11 09:56:20 -08:00
Eric House
4a3133924a name change for clarity 2017-11-11 09:14:35 -08:00
Eric House
0831bd8022 talk to relay.py/kill, first web api use from android
And it seems to work!
2017-11-11 08:22:52 -08:00
Eric House
31123b72ce fix failure to notify relay of half-game deletion
Wasn't detecting as a relay game something registered on relay but not
yet joined by another device, a common case!
2017-11-11 08:13:29 -08:00
Eric House
da3f6db9e4 fix failure to notify relay of half-game deletion
Wasn't detecting as a relay game something registered on relay but not
yet joined by another device, a common case!
2017-11-11 08:10:48 -08:00
Eric House
acf668ae8a add new prefs controlling web api usage
Add, but don't use yet, prefs giving relay.py path and checkbox whether
to use the new APIs.
2017-11-10 22:16:15 -08:00
Eric House
f2c4c82129 a shot at no-conn connecting
Ideally the comms module wouldn't go through its connecting routine in
order to join a game. To that end I added a join() method to relay.py
and code to call it. Joins happen (pairing games, starting new ones,
etc.), but after that communication doesn't. First part of fixing that
would be to make cookieID persistent and transmit it back with the rest
of what join sends (since it's used by all the messages currently sent
in a connected state), but I suspect there's more to be done, and even
that requires a fair number of changes on the relay side. So all that's
wrapped in #ifdef RELAY_VIA_HTTP (and turned off.)
2017-11-10 21:34:02 -08:00
Eric House
ecc247d56d fix a couple of obvious bugs 2017-11-10 20:30:25 -08:00
Eric House
d1e6a0d1d3 fix seed comparison: ints vs strings
Was coming in as a string when called via curl. This may be a problem
for other ints if I go with lots of params instead of a json, which is
looking less likely.
2017-11-09 06:47:33 -08:00
Eric House
d0dd7a2c02 new columns required by relay.py's join() 2017-11-08 08:07:47 -08:00
Eric House
205adf0d0f add prototype of join()
join's how devices will create or join existing games. It more
compilicated than I'd like but seems to work except that once a slot's
assigned it's unavailable to anybody else even if the other fails ever
to respond (i.e. needs the ACK function of the c++ relay.)
2017-11-08 08:04:57 -08:00
Eric House
6c8b9d5277 fix query syntax: % operator bad 2017-11-07 07:34:06 -08:00
Eric House
c661c8a74e basic join() (inserting/updating game records) works 2017-11-07 07:33:04 -08:00
Eric House
e6acd0fbcc beginnings of new relay: shows persistence
Mostly comments, it's where I'll start to think about the API for a
web-app version of the relay. The server itself ought to exist
already.
2017-11-05 19:24:41 -08:00
Eric House
02f05dc867 fix to compile with UDP packet logged
to match up with delivery on client
2017-11-04 09:27:33 -07:00
Eric House
7efcdf0cb8 script for tracking message delivery
The http-based comms flow is stalling. This will help figure out why.
2017-11-04 09:27:33 -07:00
Eric House
1648c9b3e3 tweak to start GTK games and run a long time
I'm trying to fix game-start-time right now....
2017-11-04 09:27:33 -07:00
Eric House
3a2953427a combine adjacent QUERY tasks
Trying to reduce the size of the queue. Eventually the lists of relayIDs
will need to be merged.
2017-11-04 09:27:33 -07:00
Eric House
c4312a2158 new files that may replace GSList in relaycon
If I want to move relaycon into common so Android can use it (assuming
the jni code starts including json-c and libcurl so it can handle
networking) I'll need a replacement for GSList. This is a start.
2017-11-04 09:27:33 -07:00
Eric House
9f5f5da29c add more required debs 2017-11-03 18:07:12 -07:00
Eric House
24171d8317 log more about tasks 2017-11-02 07:16:51 -07:00
Eric House
3dfd419ec7 relay returning NOTHING is a thing; deal with it 2017-11-02 07:16:11 -07:00
Eric House
55f5b500e3 cleanup: method names and logging 2017-11-02 06:19:35 -07:00
Eric House
66d6240ece better git revision fallback 2017-11-01 06:12:04 -07:00
Eric House
220918e5cd fix to compile with gdk3.2 (latest Debian) 2017-11-01 05:16:32 -07:00
Eric House
61937ac2d0 use float consistently
timeout of 0 was not making the relay.py script happy
2017-10-31 20:07:12 -07:00
Eric House
a1433e5f3d add kill to relay.py; call from test script using curl
It'll eventually get called from Android and maybe linux, but for now
it's cool to have games disappear from the showinplay display when
they're done.
2017-10-31 20:05:07 -07:00
Eric House
8aeba861cf fix script to move db files again 2017-10-31 06:38:32 -07:00
Eric House
23f0d54f63 tweaks: add comment; show only pending messages 2017-10-30 19:07:13 -07:00
Eric House
d2897d6dc8 fix to match format of empty return case 2017-10-30 19:06:38 -07:00
Eric House
8ee17493ac log length of task lifetime
Need to figure out where the delays are.
2017-10-30 07:12:34 -07:00
Eric House
3d3a986dbd log count of tasks abandoned in queue on shutdown
This confirms that I need to process outgoing messages more quickly,
likely by combining them.
2017-10-29 09:46:51 -07:00
Eric House
1373d0b1db make min-run configurable
With the new http stuff, at least for now, it takes longer to get things
communicated and so killing games after 2 seconds of runtime meant no
moves ever got made. Making it configurable, and passing 10 (seconds)
means nearly all games in a large test run complete reasonably quickly.
2017-10-29 09:26:07 -07:00
Eric House
7b50c90aac pass timeoutSeconds
ACK doesn't need to wait 2 seconds for a reply, and when it does so the
next send waits too. Eventually we'll want to combine messages already
in the queue into a single send. For now, this makes things better.
2017-10-28 20:12:05 -07:00
Eric House
7c22d1fdf8 fix failure of http apps to ack relay
Change how acks are handled by adding ability to look up connname by
combination of hid and token. It's a bit of a hack, but it's already
there in the protocol and enough to find the game.
2017-10-28 16:29:04 -07:00
Eric House
3e9381d946 use a single timer and a queue for received data
using g_add_idle() for each piece of data received on the (background)
curl-query thread wasn't working. They were getting starved, and I think
some were considered duplicates and never scheduled. So add a single
timer proc called every 50 ms and a queue that it checks and into which
the network thread can put stuff.
2017-10-28 16:13:11 -07:00
Eric House
7d4fb1cc5d get rid of last [] from map access 2017-10-28 15:36:33 -07:00
Eric House
3215affd68 tweaks to test script 2017-10-28 15:31:17 -07:00
Eric House
e3b2a0e4e1 fix misbehavior by new in-memory map
I don't know why what I was doing didn't work, but removing access via
[] and using iterators passes all the asserts I could throw at it.
2017-10-28 15:01:31 -07:00
Eric House
952272172a always log bytes sent 2017-10-27 05:58:35 -07:00
Eric House
a8f06b53e2 test script; log threadid 2017-10-27 05:57:40 -07:00
Eric House
3645331061 pass hid in to db function getting per-dev info
Somehow I've been failing to treat this column as an array for some
time. I don't have any test cases that failed but it was clearly
wrong. Test cases still pass....
2017-10-25 20:33:25 -07:00
Eric House
051b6a7220 change resign-ratio to resign-pct
To match the way other pct stuff works, in part because it seemed it
didn't.
2017-10-25 20:00:55 -07:00
Eric House
6e06fdea07 stop storing cid in database
It's a runtime-only thing, explicitly removed from db on boot. So add a
map from connname->cid to the dbmgr class and modify that rather than a
column. Passes discon_ok2.sh tests as long as use-http stuff isn't on.
2017-10-25 19:56:56 -07:00
Eric House
14d9063ad0 add --room to error message/hint 2017-10-25 06:43:10 -07:00
Eric House
81df91c4db add commandline option to spec log dir location 2017-10-25 06:34:55 -07:00
Eric House
d05a67ed4b switch to milliseconds 2017-10-25 06:15:46 -07:00
Eric House
cc54621e45 store message first, remove on ack 2017-10-25 05:51:45 -07:00
Eric House
c68a067009 add option to not check moves except manually 2017-10-24 19:18:19 -07:00
Eric House
6ff13e6e23 move 'check moves' menu to main window 2017-10-24 19:14:23 -07:00
Eric House
342d229be1 refactor 2017-10-24 07:07:22 -07:00
Eric House
28bec6d456 implement checkForMoves menu again 2017-10-24 06:20:08 -07:00
Eric House
2cfac68f91 leave out entries without relayIDs
SQL is the easiest place to filter
2017-10-23 21:08:14 -07:00
Eric House
c3887b9c77 use a single thread and a protected queue
I don't want race conditions between threads talking to the server.
2017-10-23 21:07:05 -07:00
Eric House
6787fe1406 fix length byte 2017-10-22 21:29:16 -07:00
Eric House
4583b5d88d use ! with struct instead of ntohs 2017-10-22 15:47:01 -07:00
Eric House
4c15723f90 add http option to test script 2017-10-22 11:43:56 -07:00
Eric House
16ee3e9439 rename and make self-initing 2017-10-22 10:05:36 -07:00
Eric House
523fd26eee make relay hostname configurable 2017-10-22 09:58:01 -07:00
Eric House
f49c81462c wip: received messages dispatched to games 2017-10-22 09:29:15 -07:00
Eric House
43ffb156fc wip: successfully get list of moves 2017-10-22 07:30:14 -07:00
Eric House
47a048d553 fetch relayIDs from db 2017-10-21 16:05:54 -07:00
Eric House
a65af79953 add check for being on main thread 2017-10-21 15:23:46 -07:00
Eric House
ec7fde3b62 add relayID to DB and to table 2017-10-21 14:59:10 -07:00
Eric House
a6602fabe0 hide menuitem when not in http mode 2017-10-21 14:24:38 -07:00
Eric House
284888df44 add timeoutSecs param 2017-10-21 12:13:19 -07:00
Eric House
37162e0471 fix curses commit; refactor & cleanup 2017-10-21 12:11:26 -07:00
Eric House
816df4336c run post in thread since it takes time 2017-10-20 06:26:46 -07:00
Eric House
3045697d31 wip: process moves received 2017-10-19 21:20:14 -07:00
Eric House
5223ccabe1 add option to run forever 2017-10-19 20:50:33 -07:00
Allan Nordhøy
ebe594ed1d Added translation using Weblate (Norwegian Bokmål) 2017-10-19 11:48:34 +02:00
Eric House
4a1e51b54a call query from C
Very rough code that fetches messages and does nothing with them.
2017-10-18 22:03:14 -07:00
Eric House
7414e0eeae param should be json array as string 2017-10-18 22:02:14 -07:00
Eric House
9b486d77fb shrink column to shrink display 2017-10-18 21:19:42 -07:00
Eric House
3ffef37d77 don't require myKey.py 2017-10-18 21:19:09 -07:00
Eric House
fbaa1f139e add test method and implement query() endpoint 2017-10-18 21:18:30 -07:00
Eric House
e6e93c09ab oops: use the right length 2017-10-18 07:19:43 -07:00