re-export async tls streams with async prefix

This commit is contained in:
Rob Ede 2021-11-30 00:57:06 +00:00
parent 4b35c052ef
commit bd5d971dde
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
3 changed files with 13 additions and 13 deletions

View File

@ -11,7 +11,7 @@ use futures_core::future::LocalBoxFuture;
use log::trace; use log::trace;
use tokio_native_tls::{ use tokio_native_tls::{
native_tls::TlsConnector as NativeTlsConnector, TlsConnector as AsyncNativeTlsConnector, native_tls::TlsConnector as NativeTlsConnector, TlsConnector as AsyncNativeTlsConnector,
TlsStream, TlsStream as AsyncTlsStream,
}; };
use crate::connect::{Connection, Host}; use crate::connect::{Connection, Host};
@ -45,7 +45,7 @@ impl<R: Host, IO> ServiceFactory<Connection<R, IO>> for TlsConnector
where where
IO: ActixStream + 'static, IO: ActixStream + 'static,
{ {
type Response = Connection<R, TlsStream<IO>>; type Response = Connection<R, AsyncTlsStream<IO>>;
type Error = io::Error; type Error = io::Error;
type Config = (); type Config = ();
type Service = Self; type Service = Self;
@ -64,7 +64,7 @@ where
R: Host, R: Host,
IO: ActixStream + 'static, IO: ActixStream + 'static,
{ {
type Response = Connection<R, TlsStream<IO>>; type Response = Connection<R, AsyncTlsStream<IO>>;
type Error = io::Error; type Error = io::Error;
type Future = LocalBoxFuture<'static, Result<Self::Response, Self::Error>>; type Future = LocalBoxFuture<'static, Result<Self::Response, Self::Error>>;

View File

@ -15,7 +15,7 @@ use actix_utils::future::{ok, Ready};
use futures_core::ready; use futures_core::ready;
use log::trace; use log::trace;
use openssl::ssl::SslConnector; use openssl::ssl::SslConnector;
use tokio_openssl::SslStream; use tokio_openssl::SslStream as AsyncSslStream;
use crate::connect::{Connection, Host}; use crate::connect::{Connection, Host};
@ -57,7 +57,7 @@ where
R: Host, R: Host,
IO: ActixStream + 'static, IO: ActixStream + 'static,
{ {
type Response = Connection<R, SslStream<IO>>; type Response = Connection<R, AsyncSslStream<IO>>;
type Error = io::Error; type Error = io::Error;
type Config = (); type Config = ();
type Service = TlsConnectorService; type Service = TlsConnectorService;
@ -89,7 +89,7 @@ where
R: Host, R: Host,
IO: ActixStream, IO: ActixStream,
{ {
type Response = Connection<R, SslStream<IO>>; type Response = Connection<R, AsyncSslStream<IO>>;
type Error = io::Error; type Error = io::Error;
type Future = ConnectFut<R, IO>; type Future = ConnectFut<R, IO>;
@ -110,7 +110,7 @@ where
.expect("SSL connect configuration was invalid."); .expect("SSL connect configuration was invalid.");
ConnectFut { ConnectFut {
io: Some(SslStream::new(ssl, io).unwrap()), io: Some(AsyncSslStream::new(ssl, io).unwrap()),
stream: Some(stream), stream: Some(stream),
} }
} }
@ -119,7 +119,7 @@ where
/// Connect future for OpenSSL service. /// Connect future for OpenSSL service.
#[doc(hidden)] #[doc(hidden)]
pub struct ConnectFut<R, IO> { pub struct ConnectFut<R, IO> {
io: Option<SslStream<IO>>, io: Option<AsyncSslStream<IO>>,
stream: Option<Connection<R, ()>>, stream: Option<Connection<R, ()>>,
} }
@ -128,7 +128,7 @@ where
R: Host, R: Host,
IO: ActixStream, IO: ActixStream,
{ {
type Output = Result<Connection<R, SslStream<IO>>, io::Error>; type Output = Result<Connection<R, AsyncSslStream<IO>>, io::Error>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let this = self.get_mut(); let this = self.get_mut();

View File

@ -17,7 +17,7 @@ use actix_utils::future::{ok, Ready};
use futures_core::ready; use futures_core::ready;
use log::trace; use log::trace;
use tokio_rustls::rustls::{client::ServerName, OwnedTrustAnchor, RootCertStore}; use tokio_rustls::rustls::{client::ServerName, OwnedTrustAnchor, RootCertStore};
use tokio_rustls::{client::TlsStream, rustls::ClientConfig}; use tokio_rustls::{client::TlsStream as AsyncTlsStream, rustls::ClientConfig};
use tokio_rustls::{Connect as RustlsConnect, TlsConnector as RustlsTlsConnector}; use tokio_rustls::{Connect as RustlsConnect, TlsConnector as RustlsTlsConnector};
use webpki_roots::TLS_SERVER_ROOTS; use webpki_roots::TLS_SERVER_ROOTS;
@ -71,7 +71,7 @@ where
R: Host, R: Host,
IO: ActixStream + 'static, IO: ActixStream + 'static,
{ {
type Response = Connection<R, TlsStream<IO>>; type Response = Connection<R, AsyncTlsStream<IO>>;
type Error = io::Error; type Error = io::Error;
type Config = (); type Config = ();
type Service = TlsConnectorService; type Service = TlsConnectorService;
@ -96,7 +96,7 @@ where
R: Host, R: Host,
IO: ActixStream, IO: ActixStream,
{ {
type Response = Connection<R, TlsStream<IO>>; type Response = Connection<R, AsyncTlsStream<IO>>;
type Error = io::Error; type Error = io::Error;
type Future = ConnectFut<R, IO>; type Future = ConnectFut<R, IO>;
@ -132,7 +132,7 @@ where
R: Host, R: Host,
IO: ActixStream, IO: ActixStream,
{ {
type Output = Result<Connection<R, TlsStream<IO>>, io::Error>; type Output = Result<Connection<R, AsyncTlsStream<IO>>, io::Error>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
match self.get_mut() { match self.get_mut() {