fix(companion): off-LAN load falls back to mesh URL, not dead LAN IP
When neither the LAN origin nor the mesh ULA answers the probe window, target the mesh URL (when paired) instead of the LAN IP: off-LAN the LAN address can never answer, and loading it showed a confusing 'can't reach 192.168.x.x' error while the mesh session was still coming up. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
7e8d3314d0
commit
d576f77435
@ -227,13 +227,17 @@ private fun tcpAnswers(base: String, timeoutMs: Int): Boolean = try {
|
||||
}
|
||||
|
||||
/** Fastest answering origin: LAN inside a short window, else the mesh ULA
|
||||
* (patient — a cold session may still be establishing), else LAN anyway so
|
||||
* the existing error/fallback path handles it. */
|
||||
* (patient — a cold session may still be establishing). If NEITHER answers,
|
||||
* fall back to the mesh URL when we have one — off-LAN the LAN IP is
|
||||
* unreachable, and loading it just produced a confusing "can't reach
|
||||
* 192.168.x.x" error page (user-reported 2026-07-27). Targeting the mesh URL
|
||||
* instead means the load retries against the path that's actually coming up,
|
||||
* and any error shows the mesh address rather than a dead LAN IP. */
|
||||
private suspend fun pickStartUrl(lanUrl: String, meshUrl: String?): String =
|
||||
withContext(Dispatchers.IO) {
|
||||
if (tcpAnswers(lanUrl, 2500)) return@withContext lanUrl
|
||||
if (meshUrl != null && tcpAnswers(meshUrl, 12_000)) return@withContext meshUrl
|
||||
lanUrl
|
||||
meshUrl ?: lanUrl
|
||||
}
|
||||
|
||||
/** Apply the WebView settings shared by the kiosk view and the in-app browser.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user