1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-23 22:51:07 +01:00

standardize openssl based stream name

This commit is contained in:
Rob Ede 2021-02-20 18:04:05 +00:00
parent 7e483cc356
commit 8d74cf387d
No known key found for this signature in database
GPG Key ID: C2A3B36E841A91E6
5 changed files with 17 additions and 13 deletions

View File

@ -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

View File

@ -1,6 +1,7 @@
# Changes
## Unreleased - 2021-xx-xx
* Rename `accept::openssl::{SslStream => TlsStream}`.
## 3.0.0-beta.3 - 2021-02-06

View File

@ -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<T>(tokio_native_tls::TlsStream<T>);
impl<T> From<tokio_native_tls::TlsStream<T>> for TlsStream<T> {

View File

@ -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<T>(tokio_openssl::SslStream<T>);
/// Wrapper type for `tokio_openssl::SslStream` in order to impl `ActixStream` trait.
pub struct TlsStream<T>(tokio_openssl::SslStream<T>);
impl<T> From<tokio_openssl::SslStream<T>> for SslStream<T> {
impl<T> From<tokio_openssl::SslStream<T>> for TlsStream<T> {
fn from(stream: tokio_openssl::SslStream<T>) -> Self {
Self(stream)
}
}
impl<T> Deref for SslStream<T> {
impl<T> Deref for TlsStream<T> {
type Target = tokio_openssl::SslStream<T>;
fn deref(&self) -> &Self::Target {
@ -35,13 +35,13 @@ impl<T> Deref for SslStream<T> {
}
}
impl<T> DerefMut for SslStream<T> {
impl<T> DerefMut for TlsStream<T> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl<T: ActixStream> AsyncRead for SslStream<T> {
impl<T: ActixStream> AsyncRead for TlsStream<T> {
fn poll_read(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
@ -51,7 +51,7 @@ impl<T: ActixStream> AsyncRead for SslStream<T> {
}
}
impl<T: ActixStream> AsyncWrite for SslStream<T> {
impl<T: ActixStream> AsyncWrite for TlsStream<T> {
fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
@ -81,7 +81,7 @@ impl<T: ActixStream> AsyncWrite for SslStream<T> {
}
}
impl<T: ActixStream> ActixStream for SslStream<T> {
impl<T: ActixStream> ActixStream for TlsStream<T> {
fn poll_read_ready(&self, cx: &mut Context<'_>) -> Poll<io::Result<()>> {
T::poll_read_ready((&**self).get_ref(), cx)
}
@ -116,7 +116,7 @@ impl Clone for Acceptor {
}
impl<T: ActixStream> ServiceFactory<T> for Acceptor {
type Response = SslStream<T>;
type Response = TlsStream<T>;
type Error = SslError;
type Config = ();
type Service = AcceptorService;
@ -140,7 +140,7 @@ pub struct AcceptorService {
}
impl<T: ActixStream> Service<T> for AcceptorService {
type Response = SslStream<T>;
type Response = TlsStream<T>;
type Error = SslError;
type Future = AcceptorServiceResponse<T>;
@ -168,7 +168,7 @@ pub struct AcceptorServiceResponse<T: ActixStream> {
}
impl<T: ActixStream> Future for AcceptorServiceResponse<T> {
type Output = Result<SslStream<T>, SslError>;
type Output = Result<TlsStream<T>, SslError>;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
ready!(Pin::new(self.stream.as_mut().unwrap()).poll_accept(cx))?;

View File

@ -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<T>(tokio_rustls::server::TlsStream<T>);
impl<T> From<tokio_rustls::server::TlsStream<T>> for TlsStream<T> {