Commit graph

1374 commits

Author SHA1 Message Date
Eric House
f1ee8564cb fix to compile with release flags 2019-06-29 16:44:38 -07:00
Eric House
ea0b176b2a debug-build-only macros to find proto-based crashes
When a stream reader and writer are out of sync it often shows up as
trying to read off the end of the stream (firing an assert.) It's useful
to know where that's coming from on android where there's usually no
stack trace in the jin world. So pass __func__ in using macros, and log
before asserting. Crude but quick and already useful.
2019-06-28 21:22:45 -07:00
Eric House
25cce2c7f3 add timer to gtk's new-game dialog 2019-06-24 09:20:34 -07:00
Eric House
30fd27aa53 change engine to optionally look at pending tiles
option not used ... yet
2019-05-26 17:59:00 -07:00
Eric House
012ebe26f7 differentiate betweeen PENDING and RECENT tiles
Should not show the new you-can-lookup-uncommitted-words hint for
already-played words, so needed to be able to tell difference between
the two. Now you can -- and on the gtk side I draw them differently
because I can.
2019-04-09 09:51:04 -07:00
Eric House
fec0124f8c allow long-tap lookup of pending words too
When a word's been formed as part of the current turn, but not yet
committed, allow long-tap to trigger an offer to look it up online same
as for already-committed words. Allows checking the legality of
potential plays AND figuring WTF the hint feature just suggested.
2019-04-05 11:54:58 -07:00
Eric House
0251ff0b44 use mutex to synchronize access to smsproto apis
I'm seeing my simultaneous access assert fail, so might as well break
fix it the foolproof way. It's background threads only that are calling
this stuff on Android so blocking them shouldn't hurt.
2019-04-02 16:08:08 -07:00
Eric House
8a620533e5 fix multi-message aspect of smsproto
passes --run-sms-test now, and works on Android occasionally combining messages.
2019-03-21 18:49:19 -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
21debf7af6 add missing consts 2019-03-11 10:32:22 -07:00
Eric House
2744649e48 one less malloc 2019-03-09 12:12:47 -08:00
Eric House
d914706ef8 cleanup 2019-03-08 21:32:52 -08:00
Eric House
20cd99f73b add debug-only checking for thread safety
Lots of threads call the smsproto code now so the existing check was
failing. Replace it with one that ensures that only one thread at a time
is running the code. Debug-builds only.
2019-02-27 07:13:38 -08:00
Eric House
d1881e7fc4 logging toward tracking a rare assertion failure 2019-02-26 14:33:18 -08:00
Eric House
1e0db1fca7 fix defines and compile that then broke 2019-02-22 17:55:09 -08:00
Eric House
e6b59ea11d add debug-only option for invitee players to be robots
It's useful when testing to have the remote device play without human
interaction. So add an option, and UI to trigger it, for the players
created remotely in response to an invitation to be robots. There are
guards in place to catch the feature slipping into a release build.
2019-02-07 08:17:54 -08:00
Eric House
f5c9962b66 tweak/reduce logging 2019-02-06 19:36:17 -08:00
Eric House
bf2ab49c20 remove some logging 2019-02-05 09:37:39 -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
59f1e1696e remove unused constant (enum) 2019-01-06 17:04:36 -08:00
Eric House
4a90792dec If game's in Spanish, don't require 7 tiles for trade.
Put up an error message if too many tiles selected for trade
(a condition that couldn't exist when the pool was guaranteed to
have at least 7 in it.) (It's a hack: there's not even an enum
giving Spanish's code, and the lang_locale stuff in info.txt isn't
making it into the .xwd format.)
2018-12-29 18:47:48 -08:00
Eric House
3d7d1b8ffd don't call tile picker more than once
Some devices, including my Moto, are apparently calling server_do() more
than most. When the game's supposed to be asking the user to pick tiles
that resulted in stacked TilePickAlerts. The stack of these
sending (taken together) too many picked tiles to the game made it
crash. So modify server to have only one pending tile-pick request going
at a time. Because the server can't know when the user dismisses the
alert in Android and so won't post again, respond to the dismissal by
closing the game. Reopening will put it in a state where the tile picker
can get called again.
2018-08-01 20:30:51 -07:00
Eric House
e0c6621bfe remove assert: messages not for me are common 2018-07-31 00:26:11 -07:00
Eric House
e637f49b95 include port and proto
Pretty sure couldn't have played against an older build without this.
2018-07-26 21:13:09 -07:00
Eric House
9ddc6e4b89 Move transision of cmd and gameid and port (pending) into smsproto
common code, simplifying and unifying what the platform-specific code
has to do. Seems to work.
2018-07-26 07:50:16 -07: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
352d87a327 use stream to take apart untrusted message safely
add new stream getters that return false if reach EOS and use them to
exit early and safely if incoming SMS msg is misformatted. I'm getting
random garbage meant for other apps perhaps.
2018-07-13 22:41:52 -07:00
Eric House
669acdcd19 log checksum of messages into smsproto 2018-07-13 07:39:11 -07:00
Eric House
c45c9cd809 read format spec outside assert
since the read inside goes away in release builds!
2018-07-13 06:59:57 -07:00
Eric House
b8c2cd1dd5 don't assert when a stray message wanders in 2018-07-12 20:20:04 -07:00
Eric House
df8558e071 delete partial messages when count mismatches
Had an assert fire when a message ID was reused with a different count.
It was likely because of messages crossing between two variants, but
still, fix: delete what's been saved so far when a new count shows up.
2018-07-12 08:13:32 -07:00
Eric House
95ac66370c fix off-by-one preventing delayed messages from sending 2018-07-10 07:08:57 -07:00
Eric House
9c2a722cc5 change two method names 2018-07-10 07:07:30 -07:00
Eric House
8c14ccc0d2 add new dutil to store by ptr; use for smsproto msgID 2018-07-10 06:36:34 -07:00
Eric House
e898dc509c plug leaks 2018-07-07 23:03:26 -07:00
Eric House
13cc6c79f1 add save/restore of partial messages
Handles case where the app receives only a subset of the SMS messages
into which a larger game-level message has been broken. Now when it
restarts and the remaining parts come in the whole can be reassembled.
2018-07-07 22:56:32 -07:00
Eric House
1941642607 add load and store to dutils, and implement with stubs 2018-07-06 06:56:54 -07:00
Eric House
2e9fbb8204 add common implementation of the SMS proto stuff
And use in linux client. Goal here is to reproduce then improve the
Android SMS pre- and post-processing stuff with a common/ implementation
that can be tested on linux and used wherever.
2018-07-05 21:40:56 -07:00
Eric House
ed90c9c16d implement util->dutil split for Android
So now all jni code uses a single dutil context, but also a single
mempool and jniutil instance instead of new instances of the latter two
per game and dict-iteration.
2018-07-05 08:32:19 -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
976db7b181 add mem_stream_make_raw 2018-06-27 23:24:45 -07:00
Eric House
382718bcb0 init variable
This might have made valgrind happier, though it's been a while. Can't
hurt.
2018-06-13 14:34:31 +03:00
Eric House
d240e30bf4 test script: log and show tiles left in tray
Once the pool count drops to 0, start showing the number of tiles left
in the user's tray. This prevents there being a long time when nothing
seems to be changing *and* the script from exiting early because it
thinks all games are hung.
2018-05-25 21:36:25 -07:00
Eric House
535dc29646 silence warning 2018-04-18 21:54:51 -07:00
Eric House
cee7d696fc fix stuff to make valgrind happy 2018-04-17 21:13:53 -07:00
Eric House
ff82aa4251 fix asserts that fire when test script includes undos
When I used the --undo-pct flag in discon_ok2.py asserts occasionally
fired. This fixes that, and seems not to break anything.
2018-04-14 10:42:53 -07:00