Skip to content

feat(driver,net)!: reuse socket on Windows#887

Merged
Berrysoft merged 4 commits into
compio-rs:masterfrom
Berrysoft:dev/iocp-socket-reuse
May 2, 2026
Merged

feat(driver,net)!: reuse socket on Windows#887
Berrysoft merged 4 commits into
compio-rs:masterfrom
Berrysoft:dev/iocp-socket-reuse

Conversation

@Berrysoft
Copy link
Copy Markdown
Member

Don't merge it before #885 .

This PR adds disconnect for sockets, but only on Windows.

@Berrysoft Berrysoft self-assigned this Apr 22, 2026
@Berrysoft Berrysoft added package: net Related to compio-net package: driver Related to compio-driver labels Apr 22, 2026
@github-actions github-actions Bot added breaking change enhancement New feature or request labels Apr 22, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Windows-only support for reusing TCP/Unix socket handles by introducing a disconnect operation (backed by DisconnectEx(TF_REUSE_SOCKET)) and plumbed APIs to accept/connect using a provided socket.

Changes:

  • Add Windows-only disconnect + accept_with APIs for TcpStream/TcpListener and UnixStream/UnixListener.
  • Extend the IOCP Accept op to accept a caller-provided accept socket, and add a new IOCP Disconnect op.
  • Add Windows-only TCP tests for disconnect + reuse.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
compio-net/tests/tcp_disconnect.rs Adds Windows tests for TCP disconnect + socket reuse.
compio-net/src/unix.rs Adds Windows-only accept_with and disconnect for Unix domain sockets.
compio-net/src/tcp.rs Adds Windows-only accept_with and disconnect for TCP, plus a Windows connect note.
compio-net/src/socket/mod.rs Wires Socket::disconnect and Socket::accept_with on Windows; broadens AsFd impl usage.
compio-net/src/incoming/windows.rs Updates Accept generic parameters for the new IOCP Accept signature.
compio-driver/src/sys/op/socket/iocp.rs Makes IOCP Accept accept a generic accept-socket and adds IOCP Disconnect.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread compio-net/tests/tcp_disconnect.rs
Comment thread compio-net/src/unix.rs
Comment thread compio-driver/src/sys/op/socket/iocp.rs
@Berrysoft Berrysoft enabled auto-merge (squash) April 23, 2026 10:22
@Berrysoft Berrysoft force-pushed the dev/iocp-socket-reuse branch from e535470 to 264082a Compare April 27, 2026 16:39
@Berrysoft Berrysoft requested review from AsakuraMizu May 1, 2026 19:43
Copy link
Copy Markdown
Member

@George-Miao George-Miao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Berrysoft Berrysoft merged commit 5289d65 into compio-rs:master May 2, 2026
71 of 137 checks passed
@Berrysoft Berrysoft deleted the dev/iocp-socket-reuse branch May 2, 2026 23:41
@github-actions github-actions Bot mentioned this pull request Apr 30, 2026
@github-actions github-actions Bot mentioned this pull request May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change enhancement New feature or request package: driver Related to compio-driver package: net Related to compio-net

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants