feat: Add disconnect broadcast and improve app port handling (#4502)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich 2026-02-07 16:19:10 -06:00 committed by GitHub
parent a493cf1420
commit 31790ff709
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 181 additions and 41 deletions

View file

@ -118,7 +118,7 @@ constructor(
}
private fun onConnectionChanged(c: ConnectionState) {
if (connectionStateHolder.connectionState.value == c && c !is ConnectionState.Connected) return
if (connectionStateHolder.connectionState.value == c) return
Logger.d { "onConnectionChanged: ${connectionStateHolder.connectionState.value} -> $c" }
sleepTimeout?.cancel()
@ -134,7 +134,10 @@ constructor(
}
private fun handleConnected() {
connectionStateHolder.setState(ConnectionState.Connecting)
// The service state remains 'Connecting' until config is fully loaded
if (connectionStateHolder.connectionState.value == ConnectionState.Disconnected) {
connectionStateHolder.setState(ConnectionState.Connecting)
}
serviceBroadcasts.broadcastConnection()
Logger.d { "Starting connect" }
connectTimeMsec = System.currentTimeMillis()