fix: clamp future lastHeard timestamps to current time on ingestion (#5418)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
James Rich
2026-05-12 07:35:11 -05:00
committed by GitHub
parent 6f42f07887
commit 0f2b1c064a
7 changed files with 35 additions and 12 deletions
@@ -39,13 +39,11 @@ import kotlinx.coroutines.async
import kotlinx.coroutines.cancel
import kotlinx.coroutines.launch
import kotlinx.coroutines.test.runTest
import kotlinx.coroutines.withTimeout
import kotlin.test.Test
import kotlin.test.assertContentEquals
import kotlin.test.assertEquals
import kotlin.test.assertIs
import kotlin.test.assertNotNull
import kotlin.test.assertNull
import kotlin.test.assertTrue
@OptIn(ExperimentalCoroutinesApi::class)
@@ -206,13 +204,11 @@ class WifiOtaTransportTest {
@Test
fun `close resets transport and closes TCP connection`() = runTest {
val (transport, server, connection) = createConnectedTransport()
val (transport, server, _) = createConnectedTransport()
try {
transport.close()
assertNull(withTimeout(5_000L) { connection.readLine() })
val result = transport.startOta(1L, "hash")
assertTrue(result.isFailure)
assertIs<OtaProtocolException.ConnectionFailed>(result.exceptionOrNull())