Files
lightcraft/apps
ClaudeandLochLogic 2b341bbdee Control port: close gracefully so the peer reads the last reply (Windows reset)
After rejecting a line the server closed its socket at once. A line the client sent after the
junk then arrived at a closed socket, which answers with a reset, and on Windows the reset
discards the replies the client has not read yet: the client saw os error 10053 / 10054 instead
of the error explaining why. This is the Windows x64 failure of
tcp_connection_is_closed_after_junk in #2377's CI.

serve_stream now shuts down the write side (FIN), reads and drops what is left (at most 4 MiB,
500 ms), then closes. close_gracefully is taken from #1970 by LochLogic, split out so it can
land ahead of the per-run token work; #1991 did not include it.

The test sends its last line 100 ms after the junk and reads after another 100 ms, so it fails
on every run without the fix on Windows (10053) instead of depending on timing.

Co-Authored-By: LochLogic <252105752+LochLogic@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K93HTyCiwYvbRGaAkjPvXn
2026-10-23 11:36:51 -07:00
..