Commit graph

115 commits

Author SHA1 Message Date
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
Eric House
b53f9bc578 let Pqexec fail three times, usleeping between, before restarting with an assert 2013-07-02 07:27:31 -07:00
Eric House
3d18e5832e specify server's port in conf file since at least on one of my
machines it's not what libpq expects.  (Required by upgrade from 8.4
to 9.1.)
2013-07-02 05:46:48 -07:00
Eric House
f9cebfe444 track bytes sent per device rather than per game 2013-06-27 06:23:15 -07:00
Eric House
9138cd15b7 fix problems with devices reconnecting when their ACKs didn't arrive
and their slots are empty or have been reassigned: basically we check
if a device goes where it expects, and if not treat it as a new
connection rather than a reconnect, meaning its hostid may change.
Existing device code seems ok with that -- and at any rate I don't
think ACKs get dropped much in the wild.
2013-06-26 00:38:34 -07:00
Eric House
ed16437f9a don't refuse to store message when devid isn't available 2013-06-23 19:07:45 -07:00
Eric House
d14688a6a0 fix almost-infinite loop; assert no dup devids 2013-06-22 22:24:18 -07:00
Eric House
07d6851a26 logging changes for debugging -- main not belong in main branch 2013-06-22 05:55:38 -07:00
Eric House
6027c94a43 don't pass uninitialized variables to logf 2013-06-21 07:26:11 -07:00
Eric House
985f7bfea0 tweak: don't restart whole loop on unlikely random result 2013-06-19 07:27:34 -07:00
Eric House
ecef687471 drop message, rather than asserting, if device id isn't in db. 2013-06-17 07:52:58 -07:00
Eric House
7ce939f5c0 pass rather than hard-coding column name 2013-06-17 06:48:22 -07:00
Eric House
9e67dda5a9 make use of base-64 encoding runtime-configurable 2013-05-09 22:16:48 -07:00
Eric House
5e0fd89c9e update with all relay/ changes from gtk_multigame. This is what the
live relay's running anyway.
2013-02-04 06:08:39 -08:00