Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors compio-tls’s TlsStream implementation to be futures-compatible by adapting TLS backends (native-tls and py-openssl) to futures_util::AsyncRead/AsyncWrite via compio_io::compat::AsyncStream, and routing compio’s async IO through those futures traits.
Changes:
- Replace
SyncStream-based native-tls and py-openssl handling with futures-compatible TLS stream wrappers built aroundAsyncStream+Pin<Box<...>>. - Add new
nativebackend module ported fromtokio-native-tls, and heavily rework the py-openssl backend to use a similar polling/context-pointer approach. - Update connector/acceptor implementations and feature flags to depend on
futures-utilwhere required.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| compio-tls/src/stream.rs | Reworks TlsStream to delegate IO through futures AsyncRead/AsyncWrite and adds vectored-write support. |
| compio-tls/src/py_ossl.rs | Replaces the previous drive-loop implementation with a futures-style polling adapter around SslStream. |
| compio-tls/src/native.rs | New native-tls futures adapter ported from tokio-native-tls. |
| compio-tls/src/adapter.rs | Updates connector/acceptor to construct pinned AsyncStream and use the new backend wrappers. |
| compio-tls/src/maybe.rs | Moves negotiated_alpn into a bounded impl block consistent with new TlsStream bounds. |
| compio-tls/src/lib.rs | Wires in the new native module behind the native-tls feature. |
| compio-tls/Cargo.toml | Adds futures-util as a feature dependency for native-tls and py-openssl backends. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
George-Miao
reviewed
Apr 14, 2026
Contributor
|
LGTM and go ahead with merging and all, I'll try adapting my kTLS-compat draft PR this weekend and submit tweaks if needed. |
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.
This PR ports the code of
tokio-native-tlsfor the native-tls and py-openssl backend. There might be some redundant code...As it is built on top of
AsyncStream, theTlsStreamis futures-compatible now. The downside is that it will always requireBox::pin.