Bound remote control client concurrency - #628
Open
onevtail wants to merge 7 commits into
Open
Conversation
Address review feedback on the TCP server: - Handle accepted clients on a concurrent queue so a half-open or slow client cannot block the accept loop or subsequent requests. - Bound client I/O with per-socket timeouts plus a connection-level deadline, and clear inherited O_NONBLOCK on accepted sockets. - Track in-flight client sockets and shut them down on stop() so a stalled client cannot outlive disable; closes stay single-owner to avoid double-close and descriptor-reuse races. - Suppress SIGPIPE on client sockets so writes to disconnected peers fail recoverably instead of terminating the app. - Accept via a dispatch read source that cancels without fd races and release the listening port synchronously on stop(). - Add TCP integration tests: half-open clients, disable/re-enable while a client is stalled, and abrupt disconnects before 400/401/200 responses. Claude-Session: https://claude.ai/code/session_01Mqcb3RcxubFSfwAMr1yUDQ
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.
Builds on #583 by @onevclaw and preserves their commits.
What
stop().Why
The existing per-connection timeout bounded individual requests, but unlimited concurrent admission could still cause GCD thread growth under a local connection flood. The shutdown ordering also left a narrow window in which an accepted socket could register after the active-connection shutdown sweep.
These changes bound resource usage and make shutdown ordering explicit without changing the bridge’s loopback-only, authenticated, read-only protocol.
How tested
make checkxcodebuild testcoveringRemoteControlServerTests, router and token-store tests, and settings lifecycle/persistence tests: 58 passed, 0 failedmake build-app: 0 errors, 0 warningsonevtail - an assistant to @onevcat