Ack chunks after the flash write on the inflate path and harden the decoder

Chunk acks again mean the block is in flash on both paths: the read callback
writes and acks everything decoded so far before it waits for more input.
The decoder rejects a negative distance symbol, initialises its whole state,
and the flush feeds the watchdog once per window. The static_assert on the
backend skips the static analysis build, which sets every define at once.
This commit is contained in:
J. Nick Koston
2026-09-08 10:54:18 +02:00
parent db55c1d43f
commit d1665c423d
6 changed files with 81 additions and 29 deletions
+1 -1
View File
@@ -186,7 +186,7 @@ async def test_host_ota_self_update(
if "OTA staged at" in line:
staged.set()
# The host backend has no gzip support, so the upload negotiates deflate
if "Inflated " in line:
if " bytes from " in line:
inflated.set()
dev.on_log(line)
+5 -4
View File
@@ -1567,7 +1567,8 @@ def test_perform_ota_gzip_wins_over_deflate(mock_socket: Mock) -> None:
espota2.perform_ota(mock_socket, None, io.BytesIO(original_content), "test.bin")
sent = [c[0][0] for c in mock_socket.sendall.call_args_list]
compressed = gzip.compress(original_content, compresslevel=9)
assert sent[3] == len(compressed).to_bytes(4, "big")
assert sent[4] == hashlib.md5(compressed).hexdigest().encode()
assert sent[5] == compressed
# gzip output embeds the time of compression, so compare what it holds
payload = sent[5]
assert gzip.decompress(payload) == original_content
assert sent[3] == len(payload).to_bytes(4, "big")
assert sent[4] == hashlib.md5(payload).hexdigest().encode()