Commit graph

463 commits

Author SHA1 Message Date
Eric House
a16a34adc9 cleanup comms ack fix 2024-01-11 10:50:21 -08:00
Eric House
16f525f7b9 don't ACK ACKs 2024-01-09 18:17:36 -08:00
Eric House
1ae714d834 start to remove obsolete XWFEATURE_STANDALONE_ONLY 2024-01-09 18:17:36 -08:00
Eric House
f5526652b5 remove old ifdef'd-out code 2024-01-04 09:50:24 -08:00
Eric House
c91865c991 use invite's channelNo for first incoming message
A rare stall resulted when the invitee on channel 2 responded
first. It would get assigned channel 1 and so the invitation on that
channel would get deleted. If it hadn't already reached the mqtt
server it would never be delivered. My fix is to use an invitation's
channel instead IFF its address matches the return address of the
incoming message. I'm not sure what happens if there's somehow a mix
of invited (via rematch) and invited-some-other-way players. None of
this matters for two-device games anyway.
2024-01-04 09:50:24 -08:00
Eric House
7219206214 get rid of ancient ifdef 2024-01-04 09:50:24 -08:00
Eric House
4ffaa5dd73 cleanup -- should be no behavior/code change 2024-01-04 09:50:24 -08:00
Eric House
5794cc43e3 log gameID wherever possible in comms.c and server.c 2024-01-04 09:50:24 -08:00
Eric House
1181e908dc Add option to choose how rematch-game players will be ordered
When rematching, some users have a convention that e.g. lowest scoring
player in the "parent" game goes first. So allow that, providing the
choice on each rematch until a default has been chosen. Support
changing that default in a new prefs setting.

The place I chose to enforce the order was on the host as invitees are
registering and being assigned slots. But by then there's no longer
any connection to the game that was rematched, e.g. to use its
scores. So during the rematched game creation process I create and
store with the new game the necessary ordering information. For the
3-and-4 device case, it was also necessary to tweak the information
about other guests that the host sends guests (added during earlier
work on rematching.)
2024-01-04 09:50:24 -08:00
Eric House
7b4f9ede41 cleanup: renaming only (server->host) 2024-01-04 09:50:24 -08:00
Eric House
57b78141e9 remove dead (relay) code 2023-12-04 09:31:11 -08:00
Eric House
55e36e10a7 new script to run many games per device
I need it to be much closer to Android....
2023-11-27 21:32:43 -08:00
Eric House
e78d9fbc33 add quashed to summary, and show as part of games-list state 2023-11-06 13:11:34 -08:00
Eric House
3dcac063b5 show quashed state in net state icon (DEBUG only) 2023-11-06 13:11:34 -08:00
Eric House
259357a818 reduce sending of dead-game mqtt messages
Two cases dealt with here. First, if my opponent deletes the game when
I have an un-ack'd message, I'll keep sending it forever. Fix is to
flip a bit in comms in response to a game_gone event so no more
sending will happen. (Better than emptying the queue, as it leaves
open the possibility of resurrecting the game with code changes
later.) Second, if there's a retained message from a dead game I'll
keep receiving it until it's replaced, and if the game's dead it never
will be. Fix is to add a new api endpoint noSuchGame() to the relay2
server and to call it on receiving a message for which I have no game
to deliver it to. The endpoint "unretains" the message so I won't get
it again unless it's resent.
2023-11-05 12:01:43 -08:00
Eric House
ee2a4aaf72 fix failure to deliver ACKs on MQTT
My combining messages logic failed for ACKs, sending the queue but not
the ACK unless the ACK was in the queue. Appending it at send time is
fraught, so I am instead adding ACKs to the queue, but not persisting
them, so they only last long enough to be sent after they're
added. Seems to fix a common problem of games failing to get ACKs for
their final messages after they finish.
2023-10-26 15:37:50 -07:00
Eric House
629696144f Fix ARM compile by copying rather than casting struct ptr 2023-10-25 13:55:51 -07:00
Eric House
8c60b99e82 remove some asserts Frank's seeing 2023-04-20 14:24:10 -07:00
Eric House
f9d3f9fd4e fix assertions around dropped (because ancient) messages
I'm seeing these only when opening games several years old, and they
shouldn't matter on release builds. Still....
2023-04-18 20:55:46 -07:00
Eric House
131826d34f fix release build 2023-04-06 20:22:29 -07:00
Eric House
9a5b1d466d send invites as invites, not messages
Fixes sending of invitations on Android
2023-04-06 19:54:50 -07:00
Eric House
d0a53ab3ff send invites as invites, not messages
Fixes sending of invitations on Android
2023-03-27 14:33:14 -07:00
Eric House
50ac11970e fix assertion failure when sending single unqueued message 2023-03-26 10:37:45 -07:00
Eric House
885a20845a don't send null msg queue 2023-03-25 15:31:15 -07:00
Eric House
1a8f91203e Send MQTT messages in batches
Resend sends all types in batches. Send of new messages goes back for
MQTT only and sends the whole un-ack'd queue.
2023-03-25 10:24:39 -07:00
Eric House
7b2c327ba8 change send method to take list instead of array 2023-03-25 10:24:39 -07:00
Eric House
22d0d50130 add a public part of MsgQueueElem to simplify passing outside 2023-03-25 10:24:39 -07:00
Eric House
6ec0e64657 toward changing APIs to allow combined messages for mqtt 2023-03-25 10:24:39 -07:00
Eric House
b811653c89 remove ifdef-d out code storing all messages in one queue 2023-03-25 10:24:39 -07:00
Eric House
7929ddea47 cleanup comms 2023-03-25 10:24:39 -07:00
Eric House
daac5ca098 store messages in channel rather than a single queue
Moving toward being able to send in groups per device for MQTT
optimization
2023-03-16 07:44:14 -07:00
Eric House
b27384df63 print caller in logging func 2023-03-16 07:44:14 -07:00
Eric House
e849d628d9 log when messages could be combined 2023-03-16 07:43:51 -07:00
Eric House
bb2a2dacae cleanup 2023-03-08 20:48:55 -08:00
Eric House
073271fe61 tweak test script to better test rematching 2023-03-08 20:48:55 -08:00
Eric House
a0f5e2d5d4 remove dead code 2023-02-23 10:55:05 -08:00
Eric House
5382941f63 snapshot: play via MQTT works for a while 2023-02-22 19:52:45 -08:00
Eric House
9ca291cf0d enable rematch for 3- and 4-device games
Because only the host/inviter knows the addresses of all the devices
in a game it's hard for guests to rematch (unless it's a 2-device
game, as they know the host's address.) So now, as part of telling
guests the game is ready to play, include the addresses of other
guests. It's usually only 9 bytes per device, and only happens when
more than two devices are in a game.
2023-02-16 21:36:46 -08:00
Eric House
ee859a6c6a cleanup: remove dead code 2023-02-15 08:31:51 -08:00
Eric House
34ba254e64 cleanup 2023-02-11 07:50:53 -08:00
Eric House
0e14783d3b use negotiated streamVersion to decide what to send via MQTT
No point in sending the old-topic-format MQTT messages to clients that
know about the new one, and in fact it's harmful. Devices in a game
already agree on the stream version to use and communicate it, so pass
that into comms once it's known and from there on to the device code
that builds mqtt messages.
2023-02-09 16:53:18 -08:00
Eric House
646e806ae4 get rid of stream_open(), which was a NO-OP 2023-02-04 07:44:57 -08:00
Eric House
4a57b76817 cleanup: pass xwe with closeProc rather than to destroy
It's only needed when there's a close proc, and that's rare.
2023-02-03 22:00:47 -08:00
Eric House
e79450ab4c refactor message queue access
Cleanup to reduce changes when queue storage changes, which is coming
to optimize mqtt sends.
2023-02-03 10:18:54 -08:00
Eric House
c820abb514 remove unused params 2023-02-03 10:18:54 -08:00
Eric House
fcff8dab35 send from inside comms_invite on Linux but not Android
This is probably a temporary fix for Linux not being aggressive enough
about calling comms_resendAll() when opening a game. For now, though,
test scripts fail without it.
2023-01-30 12:02:46 -08:00
Eric House
18973675d0 don't send invite from inside comms_invite() 2023-01-27 21:07:39 -08:00
Eric House
6bb14548c9 fix TransportSendInvt to include type
In failing to pass the type into TransportSendInvt I was forcing
implementations to send to all types, which led to a lot of duplicate
invitations.
2023-01-24 17:11:05 -08:00
Eric House
ffe571664c remove asserts flagging problems I can't fix yet 2023-01-24 11:38:11 -08:00
Eric House
7fdf43eba6 add logging 2023-01-23 22:08:50 -08:00