Commit graph

167 commits

Author SHA1 Message Date
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
Eric House
4aee75aeab ack all packets from clients; log acks. This is for debugging and may
not need to stay.
2013-01-27 21:26:27 -08:00
Eric House
82dc986c79 remove bad asserts and unused variable 2013-01-26 21:49:17 -08:00
Eric House
a9b459ea2e log rather than assert 2013-01-26 21:16:48 -08:00
Eric House
336e3cd289 handle all three types of message in a single thread, punting all
synchronization issues to a future point where the load demands it.
2013-01-26 11:54:48 -08:00
Eric House
8cb0a8a7a7 fix crash on startup (as done already on gtk branch) 2013-01-26 09:23:44 -08:00
Eric House
036c908b72 remove token from XWPDEV_HAVEMSGS message 2013-01-24 19:33:33 -08:00
Eric House
c465a0bb0c add loop to print when packets haven't been ack'd 2013-01-24 07:43:24 -08:00
Eric House
ce7cdab3f0 add msgid and acking to protocol -- maybe for debugging only. 2013-01-23 07:40:52 -08:00
Eric House
90b8f966f6 comment out unnecessary assert 2013-01-21 19:40:56 -08:00
Eric House
991cc8f04c fail in main mode if udp socket not set 2013-01-20 21:03:43 -08:00
Eric House
016b16a8b2 change relay alert message format to length-plus-string rather than
null-terminated for easier handling on the java end.
2013-01-20 13:06:34 -08:00
Eric House
9023440a88 reply with alert to any connection attempt when in maint mode 2013-01-20 10:03:20 -08:00
Eric House
b768d8fccc fall through to using hard-coded maxsocks value 2013-01-20 09:22:35 -08:00
Eric House
65e9789c3f add mainentance mode, triggered by a commandline flag, that does
nothing but loop waiting for connections on the UDP socket and sending
them back the error message provided on the commandline.
2013-01-19 15:17:51 -08:00
Eric House
63d3f70cdf more changes to storage and fetching of messages and to protocol so
presence of messages is reported on connect (as are bad relayIDs).
Now a game with a robot player in a "closed" game can continue.  Once
the next set of linux-side chances is committed.
2013-01-19 14:34:04 -08:00
Eric House
3984d85795 oops -- prev checkin didn't compile 2013-01-18 07:12:26 -08:00
Eric House
1c5fef6a38 relay improvements for UDP connection: record addresses, prepare to
run in separate thread, etc.
2013-01-18 07:10:47 -08:00
Eric House
7fec736947 add udp socket and protocol for use over it so that a device can
manage a single connection to the relay for all of its games.  Works
so far to the extent that the game's playable with all boards on the
same device (with checkins about to come) as long as all boards are
open.  (Client doesn't handle opening closed games yet.)
2013-01-15 18:41:17 -08:00
Eric House
98679c8363 cleanup: better encapsulation for AddrInfo 2013-01-13 10:14:06 -08:00
Eric House
c567647a8d get rid of mapping of socket->game_connection, which will not work
once UDP sockets and/or per-device (not per-game) connections come
along.  Lots of changes, most not involving code flow but a couple
that did.  So far two gtk games can connect and exchange moves.
Haven't tested reconnection or store-and-forward.
2013-01-12 16:09:24 -08:00
Eric House
2ccc297463 make number of sockets at which we assert/reboot configurable so tests
can be done with large numbers of clients.
2013-01-10 21:10:18 -08:00
Eric House
ad78129e74 changes made over the past couple of months toward tracking an
apparent thread leak.
2013-01-02 21:12:42 -08:00
Eric House
f1ee77882b Send devid with RECONN as well as CONN so games present when device
upgrades can also use GCM.  Tested on relay but not device.
2012-11-09 06:54:12 -08:00
Eric House
af89047969 treat an empty devID string as TYPE_NONE regardless of what the client claims. 2012-11-07 22:03:58 -08:00
Eric House
59937b8514 modify how devids are handled on the relay and the protocol through
which they're communicated to the device.  Device is expected to have
a platform-specific notion of ID which the relay stores in a new
devices table and indexes with a 32-bit number which is returned to
the device -- which is encouraged but not required to use it in lieu
of the longer ID in future communications.  Modify linux client and
test script to use the relay-supplied id.  Some of this is commented
out for now.
2012-11-03 10:58:01 -07:00
Eric House
3469975d2a add, still disabled by compile-time flags, code to transmit device ID
(e.g. ID Android devices get via GCM) to relay and to associate it
there with messages that need to be delivered.
2012-10-30 07:01:47 -07:00
Eric House
0f9500cea3 comment out unused param/variable 2012-10-19 17:53:15 -07:00
Eric House
866aeb2387 change relay connect message format to include client version (meaning
of which is TBD).  When a new-version client connects, store the value
it's passed. At first this will let me track how quickly people
upgrade.  Later I can use it to let different clients have different
formats to their messages e.g. to proxy.
2012-01-26 05:43:54 -08:00
Eric House
caa40fa023 store most recent IP address each device has come in on. Requires new
column in db.  Not really used yet but interesting to watch....
2012-01-04 18:14:12 -08:00