Conversation
> Body drafted by Claude (Opus 5) at andy5995's direction. Records how to build dosemu2 against a working-tree libmodemu2k and run its vmodem tests in the container, including the traps that cost time: running as root breaks the exec test, docker exec bypasses the entrypoint's UID remap, and Alpine's ldconfig shim exits 1. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
step_fast() was byte-identical in two test files and the slow-peer connector differed only in its name. Both move to test_helpers, where the next test that needs back-pressure can reach them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
> Body drafted by Claude (Opus 5) at andy5995's direction. Only ONLINE drained the socket write buffer, so leaving it threw away whatever the DTE had handed over: a +++ escape does not hang up, and those bytes are still owed to the peer. CMD now polls the socket and flushes while the carrier is up, and ATO resumes the same call with its buffers intact instead of resetting them as if it were a new connection. They are still dropped once the socket is gone, since nothing can carry them then, and m2k_pending_to_line() has to be able to reach zero. ATH and ATZ close the connection from inside CMD without a state transition, so that cleanup runs per iteration rather than on entry. Fixes #85 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #85.
Only ONLINE drained the socket write buffer, so leaving that state threw away whatever the DTE had handed over. A
+++escape does not hang up, and those bytes are still owed to the peer.CMD now polls the socket and flushes it while the carrier is up, and ATO resumes the same call with its buffers intact rather than clearing them the way a new connection has to. Bytes are still dropped once the socket is gone, because nothing can carry them then and
m2k_pending_to_line()has to be able to reach zero. ATH and ATZ close the connection from inside CMD without a state transition, so that cleanup runs on each iteration instead of on entry to the state.The telnet IAC parser state now survives ATO too. That follows from keeping the receive buffer: it can hold bytes from the middle of a sequence, and resetting the parser would misdecode them.
Two commits, in this order:
tests: share the slow-peer and no-wait step helpers—step_fast()was byte-identical in two test files and the slow-peer connector differed only in its name. No behaviour change; it builds and passes on its own, so bisect does not land on a broken tree.Keep sending queued bytes after a +++ escape— the fix and its tests.Worth knowing for review:
m2k_pending_to_dte()mirror. I do not think there is a defect there.m2k_read_to_app()tests only for app-I/O mode, never for the state, so an embedding host can still drain the DTE-side buffer afterM2K_STATE_DONE; in PTY mode DONE means the PTY has closed, so there is no descriptor left to flush to. Reopening is the right move if that reasoning is wrong.m2k_pending_to_line()reached zero, but that only says the bytes left modemu2k — the rest of the trip belongs to the kernel. Fifty polls outlasted loopback delivery on Linux and not on either BSD. An instrumented run shows one poll happening after the queue empties on Linux as well, so the assumption was wrong everywhere and only Linux was fast enough to hide it. The loops now wait on the byte count, folded into the commit that added them.