Skip to content

Commit

Permalink
chore(tls): remove redundant i/o bounds (#3647)
Browse files Browse the repository at this point in the history
this commit removes a redundant set of trait bounds from
`linkerd_tls::Client<L, C>`'s `tower::Service<T>` implementation.

this client type is generic over a `C`-typed `MakeConnection`. this
trait is effectively an alias for particular services, and already by
definition is prerequisite upon `Connection` responses that are
an asynchronous reader/writer.

see the definition of the trait, here:

```rust
// linkerd/stack/src/connect.rs

pub trait MakeConnection<T> {
    /// An I/O type that represents a connection to the remote endpoint.
    type Connection: AsyncRead + AsyncWrite;

    /// Metadata associated with the established connection.
    type Metadata;

    type Error: Into<Error>;

    type Future: Future<Output = Result<(Self::Connection, Self::Metadata), Self::Error>>;

    /// Determines whether the connector is ready to establish a connection.
    fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>;

    /// Establishes a connection.
    fn connect(&mut self, t: T) -> Self::Future;

    // contd...
}
```

thus, we can remove these bounds from the tls client. the connection is
already, by virtue of `C: MakeConnection`, an `AsyncRead + AsyncWrite`
type.

see linkerd/linkerd2#8733.

Signed-off-by: katelyn martin <[email protected]>
  • Loading branch information
cratelyn authored Feb 24, 2025
1 parent 78e6c7a commit 8e5d0fd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion linkerd/tls/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ where
T: Param<ConditionalClientTls>,
L: NewService<ClientTls, Service = H>,
C: MakeConnection<T, Error = io::Error>,
C::Connection: io::AsyncRead + io::AsyncWrite + Send + Unpin,
C::Connection: Send + Unpin,
C::Metadata: Send + Unpin,
C::Future: Send + 'static,
H: Service<C::Connection, Response = (I, Option<NegotiatedProtocol>), Error = io::Error>
Expand Down

0 comments on commit 8e5d0fd

Please sign in to comment.