On a slow, congested link every message was resent before its ack came back,
so no round trip could be timed and the timer stayed at 0.5 s: 16 datagrams per
message. Eight progress acks in a row with no timed round trip now double the
timer, up to its 2 s cap, until a sample resets it. Random loss still yields
samples, so it never triggers there.
The host platform now offers UDP through a socket drained by the wait
loops, so the host OTA integration tests cover UDP with loss, the TCP
fallback, a device error mid upload and Noise. Over UDP the device no
longer waits for the final ack, the client stops and reads a device error
as soon as one arrives, socket errors are named in the no progress error,
and the device notices the commit within 100 ms. LibreTiny without core
locking drops the UDP code at build time.
TCP gives up on links that lose many packets: retransmit timers back off and
the connection drops, so devices on poor Wi-Fi cannot be updated without being
moved. After the TCP handshake, a client that saw loss moves the upload to a
UDP byte stream that the device acks from lwIP's receive callback as datagrams
arrive, keeping at most four of them like TCP's window. Clean links stay on
TCP; blocked UDP falls back to TCP.
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
Co-authored-by: J. Nick Koston <nick@koston.org>