Commit graph

196 commits

Author SHA1 Message Date
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
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
d10e9f6235 use vlis for acks in both directions 2013-08-25 16:59:07 -07:00
Eric House
91235f3be7 begin process of using variable-length-ints in udp protocol. Works
between linux client and relay, but unrelased features of Android
client will be broken until fixed.
2013-08-25 12:34:35 -07:00
Eric House
38adea1612 fix infinite recursion 2013-08-22 08:23:32 -07:00
Eric House
1af12f1de2 refactor packet assembly/sending so posting message can post all,
including header.
2013-08-22 08:15:38 -07:00
Eric House
16aafccec6 to telnet interface add ability to forget device and to send to one
not known (which will make message available next time it connects or
via GCM); rename methods.
2013-08-22 06:29:20 -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
0868a33c83 print out whether message is ACK'd or not 2013-08-18 20:52:09 -07:00
Eric House
d0aca01289 clean up send message/alert code 2013-08-18 15:48:44 -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
d07bb5013d oops: function need to return something 2013-08-15 19:22:01 -07:00
Eric House
62f0819a82 Toward resurrecting ctrl feature to give runtime info about stuff that
isn't in the DB.  Step one: comment out the stuff that doesn't compile
and add ability to print all registered devices with their ages.
2013-08-15 08:44:33 -07:00
Eric House
06f0b7e411 treat KEEPALIVE same as RQSTMSGS (for now) 2013-08-15 07:25:20 -07:00
Eric House
01c97c5716 null token is a possibility if message was stored by device connecting
via tcp and device is now connecting via udp
2013-08-07 21:59:21 -07:00
Eric House
b49486fc3f cleanup: use constant and add/use isUDP() 2013-08-07 21:31:10 -07:00
Eric House
6dbabaa319 cleanup 2013-08-07 21:02:47 -07:00
Eric House
4ad6696ecc add delete-on-ack logic to another message sending site, and fix
assertion failure caused by not providing a client token on messages
being sent.
2013-08-02 22:33:06 -07:00
Eric House
1e35d676bf change constant name 2013-08-02 07:31:41 -07:00
Eric House
4ecb0f534d For a subset of stored messages sent, don't remove from DB until
they're acked.  (This is the goal for all messages sent via UDP, but
will be harder elsewhere in the code.)
2013-08-01 07:48:44 -07:00
Eric House
684effd170 cleanup 2013-08-01 06:12:58 -07:00
Eric House
d8a4b5ce29 include udp maxInterval, the number of seconds the relay's configured
to assume an address is still good when it hasn't heard from it, in
reg response reply, send that reply always, and read and log the new
field on clients.  It will eventually be used to implement a
keepalive.
2013-07-29 07:27:30 -07:00
Eric House
cdea106824 change param to simplify code a bit 2013-07-29 06:33:31 -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
bfc617720e add isCurrent() method on UDP addresses based on how long it's been
since we've received data from the same source, and use to drop
packets in response to reads that are older than when the test says
the endpoint of the address changed.
2013-07-23 06:21:57 -07:00
Eric House
acca4d14d4 new files to track how long it's been since data's been received from
a UDP address.  The idea's that when there's too long a gap the
address has likely been recycled and we shouldn't send replies to
packets received before the reset.
2013-07-22 07:26:14 -07:00
Eric House
48a2567edf log contents of incoming udp packets 2013-07-22 06:06:39 -07:00
Eric House
464ef49018 add new send_via_udp that may be able to check for address validity 2013-07-20 10:37:38 -07:00
Eric House
61992943dd Add mapping from address to devid in order to catch when an address is
reused.  That required making AddrUnion a class rather than a simple union.
2013-07-20 08:06:14 -07:00
Eric House
2ce097629f log contents of udp packets as b64-encoded strings for debugging; off
by default.
2013-07-18 06:52:07 -07:00
Eric House
06dd9a99a1 better logging 2013-07-17 21:34:52 -07:00
Eric House
d436232800 correctly log b64 dump of return address at record and use sites 2013-07-17 06:38:25 -07:00
Eric House
1638d964fb log socket address to try to track down apparent misaddressing 2013-07-16 06:38:26 -07:00
Eric House
e80fe76652 assert we don't go out of bounds on array 2013-07-15 07:33:27 -07:00
Eric House
b5714e9d14 improve API: hide special numbers inside implementation 2013-07-12 08:24:44 -07:00
Eric House
5814febad5 better client token logging 2013-07-10 23:13:50 -07:00
Eric House
d50c808f96 Merge branch 'android_branch' into gtk_multigame
Conflicts:
	xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java
	xwords4/common/comms.c
	xwords4/linux/cursesmain.c
	xwords4/linux/cursesmain.h
	xwords4/linux/gtkmain.c
	xwords4/linux/gtkmain.h
	xwords4/linux/linuxmain.c
	xwords4/linux/main.h
	xwords4/linux/scripts/discon_ok2.sh
	xwords4/relay/xwrelay.cpp

(Note: The curses app crashes on exit with mempool assertions, but that's a problem before the merge.)
2013-07-09 07:18:00 -07:00
Eric House
e8022d44ea correctly parse hid from relayID, fixing assertion failure. I'm not
sure how it ever worked....
2013-07-05 21:26:17 -07:00
Eric House
a93eb4a511 fix assertion failure: log and drop packet when hid outside of accepted range. 2013-07-05 08:01:31 -07:00
Eric House
0a794f390f fix off-by-one error leading to malformed queries 2013-06-28 18:47:11 -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
519f90a69a go with non-blocking sockets for tcp connections, adding the ability
to reassemble packets that arrive in separate recv() calls.
2013-06-24 07:09:57 -07:00
Eric House
5dadbfdad3 drop messages without enough delivery info 2013-06-22 06:01:42 -07:00
Eric House
2a35fac1e8 rather than invalidating socket in AddrRec when it's closed, add a
timestamp set when it's opened.  Older copies with the same socket can
be tested against the cannonical copy maintained by tpool and sending
avoided when the timestamp shows the endpoint has likely changed.
Change tpool's list of sockets to a map for faster lookup, and get rid
of similar structure in udpqueue.
2013-06-21 06:05:26 -07:00
Eric House
eccd31472f fix crash when udp not in use 2013-05-27 16:17:58 -07:00
Eric House
d74814a806 part of previous (merge) commit that got left out -- files not saved. 2013-05-09 06:33:19 -07:00
Eric House
7d8cddb31f Merge branch 'android_branch' into gtk_multigame
Conflicts:
	xwords4/linux/gtkmain.c
	xwords4/linux/linuxmain.c
	xwords4/relay/xwrelay.cpp
2013-05-08 07:37:55 -07:00
Eric House
eafac8724e don't stop processing message referring to multiple games as soon as
one of them can't be found.
2013-02-08 20:58:09 -08: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
Eric House
9ee16adc3a add support for udp-based delete and anonymous (relay-provided) regIDs 2013-01-29 07:38:07 -08:00