Thanks to visit codestin.com
Credit goes to github.com

Skip to content

refactor(net)!: add TcpSocket & UnixSocket#817

Merged
Berrysoft merged 6 commits into
compio-rs:masterfrom
Berrysoft:dev/tcp-unix-socket
Apr 2, 2026
Merged

refactor(net)!: add TcpSocket & UnixSocket#817
Berrysoft merged 6 commits into
compio-rs:masterfrom
Berrysoft:dev/tcp-unix-socket

Conversation

@Berrysoft
Copy link
Copy Markdown
Member

This PR adds TcpSocket & UnixSocket, and removes SocketOpts. The APIs and basicly the same as tokio, without some deprecated ones.

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

Refactors compio-net socket configuration APIs by introducing TcpSocket and UnixSocket and removing the shared SocketOpts builder, updating downstream usage accordingly.

Changes:

  • Added TcpSocket and UnixSocket types to configure sockets prior to connect() / listen().
  • Removed SocketOpts and simplified TcpListener/UnixListener/UdpSocket constructors to use fixed defaults.
  • Updated compio-ws TLS connection setup and compio-net TCP connect tests to the new APIs.

Reviewed changes

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

Show a summary per file
File Description
compio-ws/src/tls.rs Updates WebSocket TLS connect path to use TcpStream::connect and sets TCP_NODELAY post-connect.
compio-net/src/tcp.rs Removes SocketOpts plumbing, adds TcpSocket, and adds several socket option accessors.
compio-net/src/unix.rs Removes SocketOpts plumbing, adds UnixSocket, and adds take_error helpers.
compio-net/src/udp.rs Removes SocketOpts from UDP bind path.
compio-net/src/opts.rs Deletes the SocketOpts implementation.
compio-net/src/lib.rs Removes the opts module and SocketOpts re-export.
compio-net/tests/tcp_connect.rs Updates bind-and-connect test to use TcpSocket APIs.

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

Comment thread compio-net/src/unix.rs Outdated
Comment thread compio-net/src/unix.rs Outdated
Comment thread compio-net/src/unix.rs Outdated
Comment thread compio-net/src/tcp.rs Outdated
Comment thread compio-net/src/tcp.rs Outdated
Comment thread compio-net/src/tcp.rs Outdated
Comment thread compio-net/src/tcp.rs Outdated
@Berrysoft Berrysoft requested a review from George-Miao March 30, 2026 17:30
@George-Miao
Copy link
Copy Markdown
Member

Add some document on {Tcp,Unix}Listener::bind/{Tcp,Unix}Stream::connect that to configure the socket before binding/connecting, you can use corresponding Socket type.

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.

prev comment.

@Berrysoft Berrysoft requested a review from George-Miao March 31, 2026 07:13
@George-Miao George-Miao force-pushed the dev/tcp-unix-socket branch from d6b9b63 to 7106f67 Compare April 2, 2026 03:05
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 added this pull request to the merge queue Apr 2, 2026
Merged via the queue into compio-rs:master with commit d71661e Apr 2, 2026
66 checks passed
@Berrysoft Berrysoft deleted the dev/tcp-unix-socket branch April 2, 2026 17:21
@github-actions github-actions Bot mentioned this pull request Apr 2, 2026
This was referenced Apr 21, 2026
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.

3 participants