Commit graph

850 commits

Author SHA1 Message Date
Eric House
6f3be5933f test script taken from eehouse.org (it works) 2019-07-07 13:00:06 -07:00
Eric House
1ce243904e bring in changes from eehouse.org
This is what's been running for months, so committing it.
2019-07-07 13:00:06 -07:00
Eric House
475206a373 don't assume send will succeed
(Pulling in change that's been on eehouse.org for a while)
2019-07-07 13:00:06 -07:00
Eric House
0be3bb192d Wait for ACK to remove stored message
Bringing in a change that's been on the production relay for a while but
apparently didn't pass tests locally. Now it does.
2019-03-17 11:52:48 -07:00
Eric House
9bde550455 apply ordering and limit correctly 2019-03-17 11:38:00 -07:00
Eric House
ce2ec03d3e relay tracks variantCode int, not string 2019-03-07 18:12:26 -08:00
Eric House
e98519ea38 stop storing fcm keys and similar data in postgres arrays
Not sure why I was doing this, but it's not worth the
trouble (e.g. stopping updates of other data to fix an android bug
sending too many reregistration messages.) So now just use the first
element of arrays, replacing what's there instead of prepending. Ideally
those columns would not be arrays, but that's a harder change.
2019-02-02 21:49:50 -08:00
Eric House
23fe3a1dd6 make script executable 2019-02-02 15:50:17 -08:00
Eric House
4a335522d2 fix so success detected from new API 2019-02-01 20:51:07 -08:00
Your Name
cd777f3b9c pull and display new field 2019-02-02 00:20:35 +00:00
Eric House
c0783fba16 don't save duplicate devIDs
There's likely a bug in Android now where I'm registering over and
over though the fcm id hasn't been changed. That's wrong, but it's
also wrong (and filling up the db) to register a duplicate as if it
were new. So stop that.
2019-02-01 12:13:05 -08:00
Eric House
15a2897112 Revert "toward compiling with gcc8"
This reverts commit d293517e7c.
2019-01-29 09:05:54 -08:00
Eric House
d293517e7c toward compiling with gcc8
My VSIZE is no longer legal, and apparently there's no workaround (no
way to safely figure the length of an array whose size is known at
compile time.) To avoid the risk of duplicating little constants, added
macros that define length in a way a new VSIZE can pick it up. Couldn't
make that work for struct field arrays, however, so there I'm using
constants.
2019-01-28 17:24:53 -08:00
Eric House
a14b43bba0 communicate variant to relay, and store in new column 2019-01-27 06:31:21 -08:00
Eric House
b4096de8ca rewrite of gcm_loop.py to use FCM
Works on my test VM. Untested on production.
2019-01-25 09:21:37 -08:00
Eric House
88a440acc3 add app-side support for firebase messaging
Works for xw4d variant only so far -- xw4 builds are broken!!!
2019-01-24 18:20:01 -08:00
Eric House
89f4246e83 track and log types of (un-acked) messages 2018-05-24 21:03:25 -07:00
Eric House
32c93786b3 fix assert when buffer too small
read directly into vector rather than first loading into a fixed-size
buffer that's apparently occasionally not big enough.
2018-05-21 21:19:32 -07:00
Eric House
40ce484a92 fix mistaken and very broken commit
(Fortunately I never ran a relay with this in it!)
2018-05-21 21:19:25 -07:00
Eric House
1b71198d4e add valgrind option to test script 2018-04-14 10:48:20 -07:00
Eric House
fef4db0ee4 make easier to comment out 2018-03-21 07:28:49 -07:00
Eric House
74406c9bba on failure, don't log what looks like success 2018-03-09 06:45:21 -08:00
Eric House
61993fc079 add tests to the rest of the forever loops 2018-02-26 07:03:47 -08:00
Eric House
aaafe1af00 assert we aren't looping infinitely
Stuff I'm doing with invitation resends is making the relay loop
inifintely. Let's assert a small loop count instead: better to crash and
restart than loop forever unable to process requests.
2018-02-25 20:44:06 -08:00
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
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
e485af925f log milliseconds: seconds not enough. 2017-12-03 16:07:30 -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
c7f0090e15 fix script that makes the db
I've had it wrong all these years. Thanks Dave!
2017-10-10 20:36:36 -07:00
Eric House
37ecd81c04 change param names
about to introduce a second. This will make things clearer. No code
change here though.
2017-10-10 20:17:36 -07:00
Eric House
4717308c4d make new installs easier
Add make target and script option to install debs
2017-10-10 19:56:22 -07:00
Eric House
3e8839636e preserve hid when recreating games
When a device reconnects and there's no record for its
game (e.g. because an ISP's screwed up and the db and its host are
lost), recreate but keep the device's hid (position in the arrays
indicating mostly whether it's the inviter or invitee.) Tested by
running the linux scripts and deleting the games table mid-way
through, but not yet tested with android devices.
2017-10-07 10:14:27 -07:00
Eric House
6f0fb66a0d fix three-year-old huuuuge memory leak
Hadn't run Valgrind in a while. There's another too, but much smaller
and harder to track down.
2017-06-07 08:07:42 -07:00
Eric House
f06e7bdd98 don't drop duplicate reconnect
When Android client is backgrounded with a game playing (BoardActivity
on top) then brought to front again it fails to reconnect to relay
because it didn't disconnect and the relay thinks it's still there. The
right fix is in making the java code do the right thing (complete
disconnect), but it seems harmless to just honor the reconnect in this
case. Doesn't even cause leaks, per valgrind.
2017-06-06 06:27:58 -07:00
Eric House
9cd76d887d fix weird double-bang thing 2016-11-09 07:45:39 -08:00
Eric House
bba16c481e improve game query script to filter on connnames and clarify filter param 2016-06-12 18:30:19 -07:00
Eric House
3bff4c070a fix compiler warning 2016-01-21 06:25:19 -08:00
Eric House
2a3bd60740 supply missing param 2015-12-08 07:15:26 -08:00
Eric House
d468866a01 no more variables called socket; all are "sock" now. 2015-11-20 23:15:04 -08:00
Eric House
6800c2afe5 Merge branch 'android_branch' into relay_noconn
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
2015-07-11 08:27:24 -07:00
Eric House
67f4e4475c manual bring-over of relay changes for invite support 2015-07-11 08:08:22 -07:00
Relay User
9c7213e42b Make it possible to launch relay early in machine boot cycle before
postgres is running (e.g. from a @reboot shortcut in a crontab) by
having it wait, sleeping periodically, until a connection is
available. Requires new flag be passed into main.
2015-07-11 07:04:24 -07:00