Get back into a game a locked phone dropped out of
A phone locked when its turn came round could not play once it was unlocked. The game was never wrong — the host still had the position and the seat was still the player's — but the only route to it was gone, and nothing rebuilt it. The board came back with the state it had before the turn arrived, and every tap on it went nowhere. A locked phone puts its Wi-Fi radio into power save, and a link carrying nothing between one turn and the next is exactly what that drops. Four things were missing, and all four are needed: The radio is held awake for as long as there is a game on, which stops most of these drops happening at all. FULL_HIGH_PERF rather than the LOW_LATENCY its deprecation notice points at: that one only applies with the screen on and the app in front, which is the case that worked. A link with nothing on it is pinged, and answered. TCP does not report a link that died this way — the read never returns and the next write goes into a socket that leads nowhere — so without traffic of its own the app could not tell a player who was thinking from one who was gone. Both ends have to speak it or a quiet link would be dropped as dead, hence the protocol bump; the lobby already turns a mismatch away with "update both devices". A write that fails now reports the link as broken instead of closing it as though this end had meant to. That silence was the reason a dead board answered nothing and said nothing about why. And a guest that loses its link dials the host again — which is still listening, on the same port, for the whole match — and is put back in the seat it never actually left, by the device id it is already known by. The table then resyncs, which is what fills the screen back in. Coming back to the front asks for the same thing, since a client draws nothing but what it was sent and anything pushed while the link was down was pushed at nothing. Sends are serialised while I am here: a message is a line, a write is three calls, and the heartbeat writes on its own schedule. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GarwvAPvWHELNspro4foFY
This commit is contained in:
@@ -6,6 +6,11 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<!-- Network Service Discovery needs multicast to see hosts on the LAN. -->
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
|
||||
<!-- Holding a Wi-Fi lock keeps the radio out of power save while a game is
|
||||
on, so a phone locked between turns does not drop out of it. The lock
|
||||
is a wake lock as far as the system is concerned, hence the permission;
|
||||
nothing here ever holds the screen or the CPU awake. -->
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<!-- Lets the app hand a downloaded APK to the system installer. -->
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user