mirror of
https://github.com/D-Modem/app.git
synced 2026-11-28 17:38:05 -08:00
poll(ms) waited with withTimeoutOrNull { ch.receive() }. When a chunk
arrived just as the timeout fired, the cancelled receive had already
taken it from the channel, and kotlinx.coroutines drops an element
delivered to a cancelled receive. Readers that poll in short waits
(the fake fax line's modems, TransferIo under every job, the PPP
loopback's pumps) lost bytes now and then: a lost AT command or frame
became a 4-10 s stall, and on slower CI runners a failed test
(EcmTest, JobsTest.dialUpInternet on iOS, PppLoopbackTest).
The wait is now a select of the receive and a timeout, which can't both
win, so the chunk stays in the channel when the timeout does. The new
ByteQueueTest loses a chunk within the first hundred on the old code.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRSgB6M9Vp9dEP1haEE