Commit graph

321 commits

Author SHA1 Message Date
Eric House
87802150d5 fix logging macro to allow a single argument 2020-04-10 07:12:56 -07:00
Eric House
0a696cf203 cleanup 2020-04-10 07:12:56 -07:00
Eric House
8bd623d91a fix NFC
A change in how sendMsg() figured out what address types to use dropped
NFC, breaking sending on Android. Fix.
2020-03-24 15:58:06 -07:00
Eric House
5611d17849 fix so games don't stall after undo
With these changes the test script no longer produces games that don't
finish. I think they are recovering from the problems produced by one
device doing an undo while another is making a move, or other problems
produced by undo being allowed to happen on any device at any time, but
haven't analyzed the games beyond the test script's verifying that they
all finish with a Winner after all tiles are consumed.
2020-03-19 16:53:44 -07:00
Eric House
5cae732a60 fix release builds 2020-03-17 20:33:24 -07:00
katianderic
1d8bb1d0db fix Android build (requires adding new comms method) 2020-03-14 18:52:28 -07:00
katianderic
b1f7b13e78 toward fixing stalls when undo used
There are still some stalls turning up when running the test script,
especially with more than two players in a game, but but it'll be
easier to do the final debugging off my pathetic travel-only
chromebook. And things are already much better. :-)
2020-03-14 14:47:26 -07:00
katianderic
126172220f changes to fix curses app test script
especially on the 'sms' side it was broken. Now Android's broken for sure.
2020-03-14 13:43:43 -07:00
Eric House
598be04bef make curses app more like the rest
Lots of changes adding a games-list view to the app from which you
create new games, open and delete existing ones, etc. There's still
plenty that's unimplemented, but it's already more useful for testing
and development. Which is the point.
2020-01-24 09:05:16 -08:00
Eric House
0153928bcd support sending invites and moves via NFC
Use low-level NFC, a combination of emulated card and reader mode, to
work around Google's removal of "beaming" support from Android 10. App
emulates a card by declaring support in its AndroidManifest. When a game
is open that has data to send, it goes periodically into read mode. If
two devices are touched while one is in read mode and the other isn't,
they handshake and open a connection that should last until they're
separated. The devices loop, sending messages back and forth with or
without data (as available.)
2019-12-23 08:45:55 -08:00
Eric House
c7ebe6e80e add debug-only pending-msg count to connstatus display
I'm bringing this in from another branch because it'll be useful for
debugging bluetooth problems.
2019-12-10 14:42:54 -08:00
Eric House
ee9f3c36f8 fix crash opening older games
I'd forgotten that merely adding a new type changed the game's binary format.
2019-11-30 18:43:28 -08:00
Eric House
496ef73da2 cleanup and remove one bad assertion 2019-11-27 11:47:46 -08:00
Eric House
ced26e8e37 remove release-build-only warning 2019-11-27 08:44:09 -08:00
Eric House
7eaa466f78 add ability to send moves via NFC
You can now play an entire game via NFC. There's no UI though: big
question is how to make the feature "discoverable."
2019-11-23 10:53:51 -08:00
Eric House
8da3c5fc68 add comms_getPending(), and refactor to implement 2019-11-18 09:26:46 -08:00
Eric House
c69ec52502 add comms stats to conn status display (DEBUG only) 2019-11-05 08:30:38 -08:00
Eric House
685c8879c3 don't consider message received until it's processed
I think I'm seeing a bug where msg <n> is received, I record that I'm
now looking for msg <n+1>, fail to process <n> (perhaps because some
resource is temporarily unavailable?), and am now in a state where I
won't accept <n> when it's resent. This fixes this by only recording <n>
received after processing code has accepted it.
2019-11-03 08:35:56 +00:00
Eric House
96ee5bec8c start adding logging specific to comms' windowing
(Hi from Santiago)
2019-11-01 07:22:56 -07:00
Eric House
21b0815923 make msgNo reflect srcID, not channelNo
It's more useful if it's per-device unique within a game. (Just used for
debugging now, so no impact on anything.)
2019-03-18 10:55:40 -07:00
Eric House
d1881e7fc4 logging toward tracking a rare assertion failure 2019-02-26 14:33:18 -08:00
Eric House
f5c9962b66 tweak/reduce logging 2019-02-06 19:36:17 -08:00
Eric House
bdf1bd3b84 fix problems with RelayService
Darned thing was dropping packets, failing to connect games built in
response to invitations, and otherwise misbehaving. First was due to not
resheduling when exited with outbound packets in queue; second to not
overriding relayNoConnProc() (due to signature change.) Though it still
happens occasionally.... Also added timestamps to track how long it
takes a packet to be sent and ACK'd.
2019-02-04 13:28:05 -08:00
Eric House
15a2897112 Revert "toward compiling with gcc8"
This reverts commit d293517e7c.
2019-01-29 09:05:54 -08:00
Eric House
d293517e7c toward compiling with gcc8
My VSIZE is no longer legal, and apparently there's no workaround (no
way to safely figure the length of an array whose size is known at
compile time.) To avoid the risk of duplicating little constants, added
macros that define length in a way a new VSIZE can pick it up. Couldn't
make that work for struct field arrays, however, so there I'm using
constants.
2019-01-28 17:24:53 -08:00
Eric House
db641c4664 log gameSeed; generate on linux too
I'm seeing a rare case where a game connectes to relay specifying a room
and somehow gets both slots, having provided different gameSeeds the two
times. This means an opponent won't connect, the room being full in that
game. I can't reproduce, so am logging seed changes better and switching
linux client to leave seed generation to comms as Android does.
2019-01-08 08:16:50 -08:00
Eric House
84f636cbd5 always resend via SMS when opening game
It's done for other comm types too, and is necessary to get linux test
script to pass once I make SMS delivery unreliable. But it may duplicate
the tickle that Android's doing and result in duplicate messages: test.
2018-07-17 07:05:33 -07:00
Eric House
d4436b7706 Break part of util into dutil
Trying to separate what's game-specific from what can be app/device
specific (i.e. with a long lifespan, and available when a game isn't
open.)

Android will be broken after this commit and fixed after the next
2018-07-05 07:58:50 -07:00
Eric House
d46a4d13ba use mem_stream_make_raw() where possible in common code 2018-06-27 23:42:50 -07:00
Eric House
4504302b3b make "release" builds compile again
Release isn't really a thing on linux, but I'm fixing something that
only reproduces when DEBUG is undefined.
2018-02-18 11:30:54 -08:00
Eric House
ec075eff18 comment out assertion that's firing when db wiped 2017-11-11 18:49:23 -08:00
Eric House
f2c4c82129 a shot at no-conn connecting
Ideally the comms module wouldn't go through its connecting routine in
order to join a game. To that end I added a join() method to relay.py
and code to call it. Joins happen (pairing games, starting new ones,
etc.), but after that communication doesn't. First part of fixing that
would be to make cookieID persistent and transmit it back with the rest
of what join sends (since it's used by all the messages currently sent
in a connected state), but I suspect there's more to be done, and even
that requires a fair number of changes on the relay side. So all that's
wrapped in #ifdef RELAY_VIA_HTTP (and turned off.)
2017-11-10 21:34:02 -08:00
Eric House
55f5b500e3 cleanup: method names and logging 2017-11-02 06:19:35 -07:00
Eric House
bd250cfe1e log before asserting 2017-07-19 07:16:18 -07:00
Eric House
bdc1f5ff51 when game full drop message but don't assert
I'm seeing assertions when a game gets into a state I don't fully
understand: host receives messages that need a channelNo assigned but
the game's full. With luck they're duplicates and can be ignored,
because that's all I can do.
2017-06-28 07:04:15 -07:00
Eric House
95ec573169 save disabled booleans in comms state
I want them persisted since the GTK UI doesn't make sense and they
should effect background sends and receives too.
2017-05-26 07:30:42 -07:00
Eric House
b96d44393a add and use boolToStr
Just to make log messages a bit more helpful. Should be no behavior
change, and no change in code generated in release builds.
2017-01-22 14:15:29 -08:00
Eric House
8bf65622b5 fix crash duplicating no-address network game
An edge case, but: doing "new from" on a game without any connection
types crashed because of an assertion in comms that assumed
addr_setType() was being called on zero-initialized flags, which
shouldn't have been a requirement. Pulled that as well as java code that
added RELAY-type connectivity to any game that had none. If a game has
none, leave it that way.
2017-01-07 07:41:38 -08:00
Eric House
68104bcf83 remove logging 2016-12-19 22:21:51 -08:00
Eric House
33326d38a7 wifi direct: harvest and send mac address
Grab and store the local device's mac address. Add p2p as a type of
address, represented by the mac address of the recipient. Include the
local device's address in invitations sent when specified by user. Now
the WifiDirectService class is being passed a packet and the address of
the recipient; it will next need to set up sockets with every device it
encounters and map them to their mac addresses so that it can do a send.
2016-11-14 08:06:53 -08:00
Eric House
87150c7d91 replace assertion with logging and dropping event
Until I figure out why I'm see it, as it's getting in the way of other
things.
2016-08-13 17:16:20 -07:00
Eric House
19713a40ad add param to comms_resendAll to limit type of message sent
(e.g. BT). Meant to be used when a single type has become available.
2016-02-02 07:01:48 -08:00
Eric House
87517edd6f fix counting of messages sent by "Resend messages" menuitem: actually
count them, and do so based on new msgNo passed from comms that's
concatenation of channelNo and msgID so that duplicates (over multiple
transports) aren't counted twice.
2015-09-30 06:50:04 -07:00
Eric House
389a09ac1a Merge branch 'android_branch' into relay_noconn
Conflicts:
	xwords4/android/XWords4/archive/R.java
	xwords4/android/XWords4/res/values/strings.xml
	xwords4/android/XWords4/res_src/values-ba_CK/strings.xml
	xwords4/android/XWords4/res_src/values-ca_PS/strings.xml
2015-08-13 07:30:55 -07:00
Eric House
3a32d3a17b return count of messages sent from comms_resendAll(), and post it as a
toast so user sees something happened.
2015-08-13 07:05:06 -07:00
Eric House
517cfe6fda bring over saved file format change from relay_conn branch so builds
from each will be able to open each other's files.
2015-08-10 06:24:40 -07:00
Eric House
0a95bc0f42 drop messages using comms methods (e.g. SMS) for which comms hasn't
been set up. Fixes assertion firing when SMS messages go to wrong app
(normal vs CrossDbg), though the right fix is to have the two apps
using different ports so they don't get each other's messages.
2015-07-31 22:15:57 -07:00
Eric House
dad39eedde Remove devID from comms address. It's not needed yet, may never be,
and I don't want to store it until it is.
2015-07-22 06:16:29 -07:00
Eric House
0f33228155 get rematch working on linux, at least for two-device games. (Handling
the case where one of several guests wants to rematch is a hard
problem for later.) Requires passing old-style relayIDs (connname plus
device index) when devIDs aren't available, which they may not always
be.
2015-07-06 20:28:16 -07:00
Eric House
8f794fbd32 beginning of support for invite-by-relay (which is mostly interesting
for Rematch): works for linux version, provided you know the relayID
of the device you're inviting. Added to common/ a stream-saving
version of java's NetLaunchInfo I'll probably want to use there too
for cross-platform compatibility (there being no jni support for
json.)
2015-07-01 07:10:45 -07:00