Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#37, but also report the remote address #38

Closed
wants to merge 2 commits into from

Conversation

ahcodedthat
Copy link
Contributor

This PR incorporates #37 and also changes TlsListener to report the remote address, both upon successfully accepting a connection and when TLS negotiation fails or times out.

This doesn't quite do what I wanted in #36, which as you said in #36 (comment) is impossible, so reporting the remote address seems like the next best thing.

Unresolved issue: now Error has three type parameters. It's pretty messy. I could bring it back down to two by using the AsyncAccept and AsyncTls implementations as the type parameters instead (e.g. Error<TcpListener, TlsAcceptor>), but then the impl Debug can't be derived because it will get the wrong bounds (see rust-lang/rust#26925). This can be worked around by hand-writing impl Debug for Error (yuck) or by using a proc-macro crate like educe, derivative, or impl-tools (which adds a proc-macro dependency, although you already have several). What do you think?

This contains breaking changes in addition to those in #37, namely:

  • The enum variant Error::ListenerError is now struct-like instead of tuple-like, and is non_exhaustive like the enum itself.
  • Error now has three type parameters, not two, as mentioned above.
  • TlsListener::accept and <TlsListener as Stream>::next yields a tuple of (connection, remote address), not just the connection.
  • AsyncAccept now has an associated type Address, which poll_accept must now return along with the accepted connection.

tmccombs and others added 2 commits September 21, 2023 01:17
And make the errors enun non_exhaustive

BREAKING CHANGE: Adds a new variant to the Error Enum
BREAKING CHANGE: The Error enum is now non_exhaustive
BREAKING CHANGE: Now returns an error if a handshake times out
Fixes: tmccombs#36
…it in errors.

BREAKING CHANGE: The enum variant `Error::ListenerError` is now struct-like instead of tuple-like, and is `non_exhaustive` like the enum itself.

BREAKING CHANGE: `Error` now has three type parameters, not two.

BREAKING CHANGE: `TlsListener::accept` and `<TlsListener as Stream>::next` yields a tuple of (connection, remote address), not just the connection.

BREAKING CHANGE: `AsyncAccept` now has an associated type `Address`, which `poll_accept` must now return along with the accepted connection.
@tmccombs
Copy link
Owner

Merged as part of #37

@tmccombs tmccombs closed this Oct 17, 2023
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.

2 participants