From 8d74cf387dc20b4eb022ec5a52c2e1fb2bff0a8a Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sat, 20 Feb 2021 18:04:05 +0000 Subject: [PATCH] standardize openssl based stream name --- actix-rt/CHANGES.md | 3 +++ actix-tls/CHANGES.md | 1 + actix-tls/src/accept/nativetls.rs | 2 +- actix-tls/src/accept/openssl.rs | 22 +++++++++++----------- actix-tls/src/accept/rustls.rs | 2 +- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/actix-rt/CHANGES.md b/actix-rt/CHANGES.md index 6754ca33..59a4641c 100644 --- a/actix-rt/CHANGES.md +++ b/actix-rt/CHANGES.md @@ -1,6 +1,9 @@ # Changes ## Unreleased - 2021-xx-xx +* Add `ActixStream` extension trait to include readiness methods. [#276] + +[#276]: https://github.com/actix/actix-net/pull/276 ## 2.0.2 - 2021-02-06 diff --git a/actix-tls/CHANGES.md b/actix-tls/CHANGES.md index a87f0fc5..d47d46ec 100644 --- a/actix-tls/CHANGES.md +++ b/actix-tls/CHANGES.md @@ -1,6 +1,7 @@ # Changes ## Unreleased - 2021-xx-xx +* Rename `accept::openssl::{SslStream => TlsStream}`. ## 3.0.0-beta.3 - 2021-02-06 diff --git a/actix-tls/src/accept/nativetls.rs b/actix-tls/src/accept/nativetls.rs index 15e43c99..98a103a8 100644 --- a/actix-tls/src/accept/nativetls.rs +++ b/actix-tls/src/accept/nativetls.rs @@ -16,7 +16,7 @@ pub use tokio_native_tls::TlsAcceptor; use super::MAX_CONN_COUNTER; -/// wrapper type for `tokio_native_tls::TlsStream` in order to impl `ActixStream` trait. +/// Wrapper type for `tokio_native_tls::TlsStream` in order to impl `ActixStream` trait. pub struct TlsStream(tokio_native_tls::TlsStream); impl From> for TlsStream { diff --git a/actix-tls/src/accept/openssl.rs b/actix-tls/src/accept/openssl.rs index b490888a..f94e3c2d 100644 --- a/actix-tls/src/accept/openssl.rs +++ b/actix-tls/src/accept/openssl.rs @@ -18,16 +18,16 @@ pub use openssl::ssl::{ use super::MAX_CONN_COUNTER; -/// wrapper type for `tokio_openssl::SslStream` in order to impl `ActixStream` trait. -pub struct SslStream(tokio_openssl::SslStream); +/// Wrapper type for `tokio_openssl::SslStream` in order to impl `ActixStream` trait. +pub struct TlsStream(tokio_openssl::SslStream); -impl From> for SslStream { +impl From> for TlsStream { fn from(stream: tokio_openssl::SslStream) -> Self { Self(stream) } } -impl Deref for SslStream { +impl Deref for TlsStream { type Target = tokio_openssl::SslStream; fn deref(&self) -> &Self::Target { @@ -35,13 +35,13 @@ impl Deref for SslStream { } } -impl DerefMut for SslStream { +impl DerefMut for TlsStream { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } } -impl AsyncRead for SslStream { +impl AsyncRead for TlsStream { fn poll_read( self: Pin<&mut Self>, cx: &mut Context<'_>, @@ -51,7 +51,7 @@ impl AsyncRead for SslStream { } } -impl AsyncWrite for SslStream { +impl AsyncWrite for TlsStream { fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, @@ -81,7 +81,7 @@ impl AsyncWrite for SslStream { } } -impl ActixStream for SslStream { +impl ActixStream for TlsStream { fn poll_read_ready(&self, cx: &mut Context<'_>) -> Poll> { T::poll_read_ready((&**self).get_ref(), cx) } @@ -116,7 +116,7 @@ impl Clone for Acceptor { } impl ServiceFactory for Acceptor { - type Response = SslStream; + type Response = TlsStream; type Error = SslError; type Config = (); type Service = AcceptorService; @@ -140,7 +140,7 @@ pub struct AcceptorService { } impl Service for AcceptorService { - type Response = SslStream; + type Response = TlsStream; type Error = SslError; type Future = AcceptorServiceResponse; @@ -168,7 +168,7 @@ pub struct AcceptorServiceResponse { } impl Future for AcceptorServiceResponse { - type Output = Result, SslError>; + type Output = Result, SslError>; fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { ready!(Pin::new(self.stream.as_mut().unwrap()).poll_accept(cx))?; diff --git a/actix-tls/src/accept/rustls.rs b/actix-tls/src/accept/rustls.rs index c19a6cec..753d68ac 100644 --- a/actix-tls/src/accept/rustls.rs +++ b/actix-tls/src/accept/rustls.rs @@ -18,7 +18,7 @@ pub use tokio_rustls::rustls::{ServerConfig, Session}; use super::MAX_CONN_COUNTER; -/// wrapper type for `tokio_openssl::SslStream` in order to impl `ActixStream` trait. +/// Wrapper type for `tokio_openssl::SslStream` in order to impl `ActixStream` trait. pub struct TlsStream(tokio_rustls::server::TlsStream); impl From> for TlsStream {