Commit graph

107 commits

Author SHA1 Message Date
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
7fbd2bed45 Fix to compile when RELAY feature disabled 2009-11-22 18:00:20 +00:00
ehouse
5ab3425377 allow default relay port, like name, to be set at compile time 2009-11-22 16:30:20 +00:00
ehouse
3d6b43f032 fix palm and palm-arm compile problems including using changed APIs. 2009-11-19 02:22:32 +00:00
ehouse
4025c37604 Make "Room 1" the default room name. 2009-11-09 00:03:43 +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
3bdfda6548 Make it possible for multiple games to connect using the same room
name.  All new connections are stored together, and after each
connection an attempt is made to build one complete game with a host
and however many guests.  All remaining devices are moved into a new
pending record in the same state, and the completed game is treated as
always.  Seems to work, though nearly 20% of linux instances are
failing to connect the relay run from the new test script samename.sh.
Need to figure out why.

Also added logging of seed and connname to comms.c since games
launched together can no longer be certain to connect on the relay.
This allows the test script to identify joined games from their logs
and detect success or failure.

This checkin changes the relay protocol, so relay and clients will
both need to be upgraded.
2009-11-02 01:01:47 +00:00
ehouse
b24cab9af3 Just enough changes to get compiling on Palm again: seems to work
against the relay!  Begin process of displaying relay status via icon
reusing BT's spot.
2009-09-27 16:33:36 +00:00
ehouse
0e43675abf Address problems matching [re]connections to games: first, go back to
setting connName when all in a game are present.  Second, have every
host include in connections a random number.  That number is made part
of the connName and in general used to test whether a host belongs in
a particular game.  Add this "seed" to web interface.  Means new
versions for relay protocol and game stream format.  Latter is handled
correctly so older games can be opened.
2009-09-26 14:37:49 +00:00
ehouse
ef8c85734e don't send on disconnect unless connected 2009-09-22 03:50:37 +00:00
ehouse
a13e1d6488 add util_clearTimer, implement on all platforms, and call when closing
comms to fix crash on Wince when timer fired after comms had been
deleted.  The closure stored and passed in was no longer a valid ptr.
2009-09-21 12:49:08 +00:00
ehouse
e8b372c274 fix more release build unused var warnings 2009-09-20 21:11:58 +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
6603949b0e Fix bug where device quitting one game to start another with same
cookie winds up connecting to the old game -- by flagging a cref as
full and no longer accepting connections without connNames even when
in the MISSING state.  Required a protocol changes so that devices get
their connNames as early as possible.
2009-09-14 01:55:03 +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
188eea4646 Try again if fail to connect to relay. 2009-08-30 15:25:13 +00:00
ehouse
6a36c045b6 fix wince compile error 2009-08-29 13:06:48 +00:00
ehouse
dbf9daf71b Fix problems reconnecting hosts where some but not all received the
ALLHERE message and connName: change relay protocol so cookie is
included in RECONNECT message, and hostIDs are not assigned until
ALLHERE, and change host-to-game matching to use connName first but
fall back to cookie.  This fixes nearly all cases failing to reconnect
after relay goes down.
2009-08-21 12:00:09 +00:00
ehouse
926f5963a3 rename only: stream_putString to stream_catString. 2009-03-29 18:26:59 +00:00
ehouse
d7eaa8e574 Add functions names to log statements. 2009-03-08 19:54:50 +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
21d4203fe2 Empty out queue and use existing code to re-add elems we want to keep.
Candidate for 4.2.
2009-02-28 16:11:09 +00:00
ehouse
9abb637330 assert queue ok after deleting. Candidate for moving to 4.2 branch if
to be used for Palm.
2009-02-28 15:06:12 +00:00
ehouse
233bf5ffde Fix crasher: removing ACK'd messages left list in inconsistent state.
Candidate for moving to 4.2 branch if to be used for Palm.
2009-02-28 14:40:50 +00:00
ehouse
43982e1a07 validate initial message correctly when comms heartbeat not being
used; improve logging.
2009-02-07 18:14:28 +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
e570d692b5 cleanup. SMS, not BT, is the default conType for other than Palm. 2009-01-05 02:07:30 +00:00
ehouse
e32e231dd5 New stream version makes standalone and multi-device build formats the
same so new Wince can open files saved by current version.  Tweaks to
build with relay and heartbeat turned on.
2009-01-03 23:54:25 +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
a26f6ad658 flag unusued param to fix compile error; move code used only in
multi-device games inside ifdefs.
2008-10-11 17:30:35 +00:00
ehouse
f749fdd560 Remove all tabs. No code changes. 2008-05-31 03:26:16 +00:00
ehouse
c2fbb06438 force miniwindow entirely onto board even if natural position is on
tray; fix overdrawing onto miniwindow by making timer proc return a
boolean and only redrawing (on wince) when it's true.
2008-04-12 15:36:31 +00:00
ehouse
a3bc875191 Fix errors, all in debug-only code, flagged by __attribute__ format addition. 2008-03-11 12:24:23 +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
40f7295802 test for duplicate initial client message and if so drop it; add const keyword; add assertion in addr comparion in attempt to learn why duplicates are getting through. 2007-12-31 20:00:13 +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
ad78ec1fd8 Rewrite of checkIncomingStream to be cleaner and fix bug with initial messages getting dropped
while heartbeat feature was enabled.  Fixed the problem on Linux, but experience on Treo650
is still better without HB feature, so turning it off on Palm.  This seems ready for beta,
but will test a bit more.
2007-12-05 06:33:37 +00:00
ehouse
e4c2143aed Fix dialog title; send heartbeat based on when connected even if no
messages yet received; reset bt connection on palm in two stages;
remove unused param.  Change version number for beta.
2007-12-03 01:20:32 +00:00
ehouse
5457ea1b59 replace all __FUNCTION__ with __func__ 2007-12-02 19:13:25 +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
473d506611 add logging to help catch a recurring assertion 2007-09-15 13:46:59 +00:00
ehouse
242e71f04a What I meant to check in. Need to save first.... 2007-03-18 23:38:53 +00:00
ehouse
a4fb5a6d5a Always send BT reconnet message, even if there are messages to resend.
Fixes failure to reconnect when opening a saved BT game where the
other device is waiting and will need to resend.
2007-03-18 23:38:19 +00:00
ehouse
c0b515457b Cleanup: compile warning and to make logging easier. 2007-02-08 15:17:23 +00:00
ehouse
a424d54445 Add a one-byte header to BT messages so one device can signal another
that a new game's begun without dropping the connection.  On Palm,
remove connection-drop on new game.  With this change starting a new
game takes imperciptible time, down from 30 seconds.
2007-02-08 02:53:10 +00:00