Commit graph

69 commits

Author SHA1 Message Date
Eric House
c1e22dd3cf add summary DB column and jni code to fetch it to store and display number of unacked messages a game has. And add debug-only option to display it in the main list. In the future I want to be able to iterate over all these games and resend their packets (without opening them visually) when an internet connection comes back up. 2014-02-28 18:59:12 -08:00
Eric House
f6e7ece578 add comms_stop() and an assert to make sure it's called. Explicit
stop and a message to the relay when using a UDP socket makes up for
there being no notification of connection closing.
2013-01-16 06:31:09 -08:00
Eric House
c4df31892e Fix occasional infinite loop of devices sending and receiving the same
message over and over when getting updated by GCM.  The problem
occurred when one device had an un-ACKable initial message still in
its queue.  I call resendAll a lot, which caused that message to get
resent to the other game which then replied without being able to ACK
it so it remained to be sent again.  This would continue until users
moved forward in the game.  The fix is to add a backoff timer to
resendAll() so that it can't loop.  The timer is reset when an ackable
and new message is received, meaning there's been a change in what's
available to resend.  And since users calling resendAll manually
expect it to do something, add a force param that ignores the backoff.
seems to fix the problem (but needs a lot of testing.)
2012-11-13 21:25:03 -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
0ccc2331b5 address bug where message was getting ACK'd by a device that failed to
save what it had ACK'd leaving the game permanently broken.  Do that
by adding a new method game_saveSucceeded() called after the client
claims to have committed bytes returned by game_writeToStream() to
disk.  In that method comms updates the value it'll use in subseqent
ACKs.
2012-09-10 07:31:45 -07:00
Eric House
033a69be8d to make it easier to tell games apart, print the number[s] of the
remote device[s] as part of summary view and in game config screen
(read-only).  Use same field in summaries table for remote phone
numbers and bt addresses.
2012-04-18 23:23:36 -07:00
Eric House
416a1054a7 Merge branch 'android_ack' into android_bt
Conflicts:
	xwords4/common/comms.c
	xwords4/common/comtypes.h
2012-04-13 20:57:35 -07:00
Eric House
f22d9530b1 track what's been ack'd, and add method to ack what hasn't been. 2012-04-13 20:21:59 -07:00
Eric House
eec1cb00a1 wrap UUID in #ifdef XWFEATURE_BLUETOOTH 2012-02-27 20:30:48 -08:00
Eric House
47c3bd3090 track a BT game's set (singleton for two-device game) of remote
devices in summary DB so, e.g., we can quickly determine what games
care when a devices becomes available via BT.  First use of this is
notifying when a remote game's deleted -- least that's the plan.  This
commit just adds to the DB and scans the DB to build a map of
device->gameIDs array.
2012-02-06 19:02:19 -08:00
Eric House
606e733b19 add _ to typedef to reduce number of etags hits on name. No code change. 2012-02-06 06:27:53 -08:00
Eric House
6326e45892 make btAddr a string rather than array of bytes. 2012-01-31 18:43:26 -08:00
Eric House
0934f83106 add gameID to params passed to comms' sendproc, including passing
through to java layer.
2012-01-25 18:27:37 -08:00
Eric House
5f77ef6e13 get uuid from C code so can ensure linux version has same. 2012-01-19 18:28:27 -08:00
Andy2
7ab8c6eca4 re-factor sending code so essentially same message (without cookieID
that implies a connection) is sent and received by no-conn code.  Use
flags to determine if comms can support no-conn sending without making
up the message only to have it fail to send.
2011-08-16 19:36:23 -07:00
Andy2
e88af19e0a toward the ability to send replies to messages received in background
without user having to open the game, which will e.g. allow a host to
assign tiles, or a robot to move, without the phone's owner noticing
there's a message.  This is on a branch because it may never work.
2011-08-10 18:28:34 -07:00
Eric House
cbfdf992bd add compile-time option to allow passing game seed from commandline.
This should allow testing relay changes to deal better with duplicate
seeds.
2011-07-31 22:23:46 -07:00
Andy2
0eec455119 change one return type; improve logging 2011-07-04 12:46:48 -07:00
Andy2
4c5c435fb5 add new parameter so client always gets notified on connection
including how many players are still missing.
2011-05-19 05:51:00 -07:00
Eric House
7a2d279308 add logging so script can better track what state relay game is in 2010-11-18 22:27:06 -08:00
Andy2
22f7a42c1d make comms_getChannelSeed non-static so jni can call it 2010-11-08 17:22:38 -08:00
Andy2
0d7f2c4f23 add devOrder (= hostID) to params passed on connect. Should make for
better explanatory message.
2010-10-29 06:31:33 -07:00
Andy2
4cd15a9c6a Merge branch 'relay_proxy' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into relay_proxy
Conflicts:
	xwords4/common/comms.c
2010-10-29 05:27:07 -07:00
Andy2
41fc05106b add room name to callback used when device connects 2010-10-28 18:45:55 -07:00
Eric House
eba5b77494 add comms_isConnected; public room variables default to false 2010-10-27 20:50:11 -07:00
Andy2
99dbbb443c add comms_canChat, which knows better than java code what state a
connected game is in, and call it to determine whether to show the
chat icon.
2010-10-21 19:14:10 -07:00
Andy2
e637a64d96 Change param signage to fix compiler warning 2010-10-11 06:20:30 -07:00
Andy2
b742c7dbb7 add new booleans to relay address record around public rooms 2010-09-03 06:38:46 -07:00
Andy2
a34ccb424f device now passes list of "relayID"s, consisting of connName plus
device id, to relay, one for each stored game that's communicating via
the relay.  Relay parses out each relayID.  Next relay can use these
to look up whether messages are available and reply with that, and
device can put up a notification.
2010-08-22 12:16:57 -07:00
eehouse
ea6166f8c7 add comms_resetSame that resets relay with existing params. 2010-06-05 03:39:16 +00:00
eehouse
55abf1116b get relay port from prefs and pass into jni 2010-03-25 04:50:19 +00:00
eehouse
786541e9ae pass default hostname in from platform code rather than compiling it
into jni; in java pull it from preferences and pass into jni.
2010-03-21 03:12:58 +00:00
ehouse
8450c9da2b New callback called on first connect to relay and on first ALLHERE
message so users can see progress.  Handle new relay message ALLBACK
meaning "ALLHERE but not for the first time".
2009-12-14 04:03:17 +00:00
ehouse
14b060707f Report relay connection denials due to misordering out to platform,
and refuse to connect again until comms has been reset.  This goes
with platform code to put up the new game/conns dialogs on disconnect
errors.
2009-12-04 08:14:03 +00:00
ehouse
f6fb019732 Send to relay if connected, even if not all hosts present. And detect
duplicate initial packets a bit better.  This change goes with the
next checkin on the relay side: move to modified store-and-forward so
devices can connect at different times once the game is established.
2009-11-08 21:30:13 +00:00
ehouse
18e9301e87 rename Cookie to Invite, a change that may change. Rename everywhere
in clients but not in relay where cookie is too pervasive.  (There are
no code changes in this checkin.)
2009-09-14 03:11:11 +00:00
ehouse
6c4b991566 Modify comms and games APIs so single struct of callbacks is passed
instead of multiple callbacks; add callback called when relay state
changes; adapt linux and palm clients to new API.  (Wince changes
pending.)
2009-09-12 21:39:13 +00:00
ehouse
615603b66b Add define set to number of conn types compiled in; use it to compile
out conn type choice where there's only one (none to be made).  Refuse
to dismiss conns dialog when cookie not chosen.
2009-09-05 13:08:46 +00:00
ehouse
4909ae0137 Close down relay connection when comms going away. Fixes crashes when
new game is standalone and prev used relay.  Add logging code in comms.
2009-03-06 13:43:03 +00:00
ehouse
213c66b391 Reset all relay-related variable on new game. Fixes bug where devices
couldn't switch roles or join a new game.
2009-02-28 19:27:45 +00:00
ehouse
c672fcfafd Make it possible to run same binary against relay with relay heartbeat
and direct with comms heartbeat.  This mostly means changing ifdefs.
2009-02-01 15:50:58 +00:00
ehouse
1755267d55 Add support to gtk app for tranport over "sms", with files containing
base64-encoded data as the messages.  Make necessary changes to comms.
This is the foundation for doing real SMS transport on handhelds.
Currently a full robot game works for two gtk clients provided the
server is launched first.
2008-12-29 01:35:29 +00:00
ehouse
3374849111 Unify lookup by address and by channelNo; add method to check consistency of BT address. 2008-01-07 01:10:43 +00:00
ehouse
a07a5f2822 cleanup; replace a bunch of EvtAddEventToQueue calls with
postEmptyEvent; pass transport type with incoming packets so they can
be rejected if not on expected channel (to stop IR, which is always
on, from injecting into a BT game); do BT work and fire timers even
when menu is down; don't let robot run until after board is drawn for
the first time; on startup, don't let robot run until after board is
drawn once.  Up version to b3.
2007-12-09 01:59:15 +00:00
ehouse
619e7d14c0 call util_addrChange prior to closing comms to fix crash moving from
BT to standalone game; add a couple of similar assertions; up beta
version.
2007-12-07 07:50:19 +00:00
ehouse
e1d5632a7b Re-add direct-via-ip transport, and implement for linux in order to
better test heartbeats.  Fix so can play against Palm over BT.
Assertions failing on Linux when reset, but it's otherwise done.
2007-11-26 02:58:25 +00:00
ehouse
4c8cf98d24 Add and set a compile-time option so comms will set a periodic timer
and use it to send and check for heartbeats over any transport.
Caller must supply a reset proc which is called when heartbeat hasn't
been received in too long.  No changes required to comms protocol, but
that means the heartbeat interval is fixed at compile time: can't be
negotiated, and the two ends had better agree.  Currently tested with
linux host and PalmOS guest, where only the first heartbeat failure is
recovered from.  So there's some debugging to be done still.
2007-11-18 23:43:27 +00:00
ehouse
41936fe18a Byte-swap psm field to callback on ARM: now both client and host work. Move SDP-related constants out where linux can use too. 2007-11-03 22:04:06 +00:00
ehouse
cb2990b720 add const to a few formal param declarations 2006-10-15 13:53:17 +00:00