Private io and handles - #2
Draft
veloce wants to merge 6 commits into
Draft
Conversation
Four fixes to the output path, ported from dart-multistockfish. Reads take a page rather than 255 bytes, and the reader isolate sends lines to the handle in one message per chunk instead of one per line. A reader that cannot keep up fills the pipe, and the engine then blocks in write() inside its UCI loop, where it answers nothing -- `quit` included. The quit marker is recognised as a suffix rather than by matching the whole buffer. A page-sized read usually picks it up in the same call as the output written before it, and a reader that misses it never returns: it stays blocked on the pipe and becomes a second reader on the next engine's output. A marker split across two reads is carried over. Chunks are decoded with allowMalformed rather than toDartString(), which throws on a partial UTF-8 sequence. A chunk is a slice of a byte stream, so a multi-byte character can straddle two of them, and the throw would land in the reader isolate's loop and kill the only thing draining the pipe. Teardown waits for the reader to let go of the pipe before it returns. init() drains the pipe before starting an engine, and a drain that beats the reader to the marker strands it. Relatedly, _RunningEngine.exited is now completed only by a real exit code from the main isolate; dispose() is renamed detach() to say what it does. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FuSuWcxTxWr8Pv8WZhX3SW
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.
No description provided.