Commit graph

128 commits

Author SHA1 Message Date
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
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
a14b43bba0 communicate variant to relay, and store in new column 2019-01-27 06:31:21 -08: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
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
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
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
3bff4c070a fix compiler warning 2016-01-21 06:25:19 -08: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
Eric House
d096b8e8a2 cleanup -- no code change 2015-06-26 06:10:47 -07:00
Eric House
68441c60f6 add local variable to prevent some dereferencing 2014-12-10 07:48:38 -08:00
Eric House
19573af533 a more elegant way of building up params to pass to PQexecParams 2014-04-25 18:45:51 -07:00
Eric House
6eaf7a57b5 fix crash when there's a "'" in model name 2014-04-25 07:41:58 -07:00
Eric House
0897ae2ba9 log the bad query 2014-04-17 07:43:58 -07:00
Eric House
9efb044c4f simplify construction of one query 2013-10-09 21:13:22 -07:00
Eric House
bb246fd7e7 rename printf -> catf; no other changes 2013-10-09 20:20:45 -07:00
Eric House
c34fb48a2c oops -- init mutex. This may be why the relay's hanging after a
crash.
2013-10-09 20:08:29 -07:00
Eric House
63067dc374 oops: the test is equality with 'epoch' 2013-09-25 07:33:41 -07:00
Eric House
31fa2ea442 turn on feature where sent messages are marked rather than deleted.
Make default 'epoch' rather than NULL so constraint will work to
prevent duplicates, and fix insertion SQL to not violate constraint.
2013-09-25 06:38:10 -07:00
Eric House
2e6d49303b remove logging around hasNoMessages stuff -- too much 2013-09-20 04:54:05 -07:00
Eric House
af44c6d190 only append to mtimes when appending a new devid 2013-09-15 12:54:47 -07:00
Eric House
b67ea7293d add mtimes, remove mtime, for devices to track each time the devid
changes.  Eventually; now it's updated too often.
2013-09-15 12:46:40 -07:00
Eric House
c212c0e367 add in-memory cacheing of messageless-connname/hid combos. 2013-09-15 10:04:46 -07:00
Eric House
de1f1cf681 in devices table, replace devid and devtype with array so can track
history if/as they change; remove rrcount as no longer needed.
2013-09-15 09:59:51 -07:00
Eric House
2629c07256 Address problem with devids (e.g. GCM): until now when you got a new
devid you tossed your relayID and reregistered.  Which meant any
existing messages meant for your relayID were orphaned, and any open
games didn't know who they belonged to until you reconnected to them
with your new relayID.  So: modify the UDP protocol (though not on
Android yet) to include both relayID and devid with registration, with
one or the other an empty string if not present or not changed from
earlier.  I can't fix existing clients that are dropping their
relayIDs, but when one does a re-connect without a relayID I can look
it up from the existing game record, then reuse it rather than issue a
new one.  Better than nothing -- and that protocol will be obsolete
soon anyway.
2013-09-14 21:06:14 -07:00
Eric House
c115752852 supply in linux client, and look for and store on relay, os version 2013-09-07 16:17:31 -07:00
Eric House
8da0b73744 replace string_printf() with new class derived from std::string with
printf() method.
2013-09-02 13:17:42 -07:00
Eric House
d9bfc01e35 change unsigned char to uint8_t (using sed) 2013-08-29 22:55:11 -07:00
Eric House
0e6b211a76 fix treating game-targeted messages as if they were device-targeted.
Should probably have separate tables for the two types....
2013-08-29 06:37:22 -07:00
Eric House
de125eb9a6 fix GetStoredMessages to also return messages without connnames,
i.e. messages to a device rather than to a game.
2013-08-28 21:29:39 -07:00
Eric House
cd2b83c9c5 type change: use vector<uint8_t> rather than string in struct for
retrieving data from db.
2013-08-28 20:33:42 -07:00
Eric House
831018ed9d oops: remove extra format specifier 2013-08-28 19:20:37 -07:00
Eric House
35a09512ce add missing params 2013-08-26 08:41:42 -07:00
Eric House
d3c15eb58b remove logging 2013-08-25 22:23:52 -07:00
Eric House
063b01d3d8 change most len-as-short+bytes strings to vli+bytes; add device model
to what's passed for device registration, and store it in a new column
in devices table.
2013-08-25 21:20:26 -07:00
Eric House
3dee41e584 set new clntvers row in devices table at the same time as updating it
in games table.  (The latter is now redundant and will go away.)
2013-08-21 06:49:37 -07:00
Eric House
2157706dcd add client version and a desc string to devices DB and to reg info sent to relay 2013-08-20 08:09:45 -07:00
Eric House
47203437cc register devices more often; add ctrl command to send text message to
device if possible, otherwise to post it to the db (mostly for testing).
2013-08-17 14:55:19 -07:00
Eric House
61009cefc7 in advance of using memcache, keep track (in memory) of those devids
for which no messages are pending, since that's a query that can be
made by each device every minute.
2013-08-15 07:24:30 -07:00
Eric House
635b948c41 don't drop messages from devices without a devID -- lots of older
devices are in that boat.
2013-08-08 00:40:32 -07:00
Eric House
b49486fc3f cleanup: use constant and add/use isUDP() 2013-08-07 21:31:10 -07:00
Eric House
a8cc920dcf new method 2013-08-01 07:49:12 -07:00
Eric House
17b8eae1f1 clean up fetching of stored messages, and excluse those from dead games 2013-07-31 07:24:58 -07:00
Eric House
9951064439 fetch all stored messages at once to reduce number of DB calls made. 2013-07-25 06:37:53 -07:00
Eric House
2060aa4577 don't match on empty devID 2013-07-10 23:12:57 -07:00
Eric House
254b82104c reduce priority of log message 2013-07-05 08:03:31 -07:00
Eric House
883cec0652 log whether b64 encoding is being used 2013-07-05 06:56:43 -07:00
Eric House
8e12a8ef84 when we get a fatal error from postgres server, try killing then
recreating the connection.  This is untested, as fatal errors are
rare.
2013-07-03 07:36:15 -07:00