From f7d0e53efa894315e8b45f7232ffb35023e5e78b Mon Sep 17 00:00:00 2001 From: Thayne McCombs Date: Tue, 8 Mar 2022 00:49:31 -0700 Subject: [PATCH] Make it so that TlsListener is Send when using native-tls Unfortunately, I don't think this is backwards compatible. Fixes: #9 --- CHANGELOG.md | 6 ++++++ src/lib.rs | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c061899..dd16a5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Upcoming release + +### Changed + +- The implementation of `AsyncTls` for `tokio_native_tls::TlsAcceptor` now requires the connection type to implement `Send`. This in turn allows `TlsListener` to be `Send` when using the `native-tls` feature. Technically, this is a breaking change. However, in practice it is unlikely to break existing code and makes using `TlsListener` much easier to use when `native-tls` is enabled. + ## 0.4.0 - 2022-02-22 NOTE: This release contains several breaking changes. diff --git a/src/lib.rs b/src/lib.rs index 63cf8b1..341026d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -191,11 +191,11 @@ impl AsyncTls for tokio_rustls::TlsAccepto #[cfg(feature = "native-tls")] impl AsyncTls for tokio_native_tls::TlsAcceptor where - C: AsyncRead + AsyncWrite + Unpin + 'static, + C: AsyncRead + AsyncWrite + Unpin + Send + 'static, { type Stream = tokio_native_tls::TlsStream; type Error = tokio_native_tls::native_tls::Error; - type AcceptFuture = Pin>>>; + type AcceptFuture = Pin> + Send>>; fn accept(&self, conn: C) -> Self::AcceptFuture { let tls = self.clone();