Skip to content

Add explicit socket shutdown and close operations. - #31

Merged
samuel-williams-shopify merged 3 commits into
mainfrom
feat/socket-lifecycle
Oct 17, 2026
Merged

samuel-williams-shopify merged 3 commits into
mainfrom
feat/socket-lifecycle

Conversation

@samuel-williams-shopify

@samuel-williams-shopify samuel-williams-shopify commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Add directional socket shutdown, consuming socket close, and their admission-only _submit variants to Socket. Implement the same contract for native, Tokio, io_uring, and simulated backends, with a commented request/response half-close example.

Cleanup reuses the bounded pool and graceful draining already used for file close. Ordinary futures await completion and report execution errors; _submit futures await acceptance only. Shutdown borrows and privately retains the socket while accepted work runs. Close consumes exclusive ownership and rejects outstanding backend use rather than cancelling or joining operations. Applications must finish or cancel-and-await outstanding work before closing.

Socket close and shutdown currently use cleanup-pool syscalls even with io_uring selected; native SQEs remain a later optimization. Windows close preserves positive linger by switching the deregistered socket to blocking mode on the cleanup worker. Shared conformance and lifecycle tests cover half-close, pending reads, cancellation, admission, abandonment, and shutdown draining.

Base automatically changed from feat/socket-descriptors to main October 17, 2026 12:59
@samuel-williams-shopify
samuel-williams-shopify merged commit 0e75cb7 into main Oct 17, 2026
18 checks passed
@samuel-williams-shopify
samuel-williams-shopify deleted the feat/socket-lifecycle branch October 17, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant