diff --git a/actix-connect/src/ssl/openssl.rs b/actix-connect/src/ssl/openssl.rs index 9f46808c..072e8677 100644 --- a/actix-connect/src/ssl/openssl.rs +++ b/actix-connect/src/ssl/openssl.rs @@ -36,13 +36,7 @@ where T: Address + Unpin + 'static, U: AsyncRead + AsyncWrite + Unpin + fmt::Debug + 'static, { - pub fn service( - connector: SslConnector, - ) -> impl Service< - Request = Connection, - Response = Connection>, - Error = io::Error, - > { + pub fn service(connector: SslConnector) -> OpensslConnectorService { OpensslConnectorService { connector: connector, _t: PhantomData, @@ -59,8 +53,9 @@ impl Clone for OpensslConnector { } } -impl ServiceFactory for OpensslConnector +impl ServiceFactory for OpensslConnector where + T: Address + 'static, U: AsyncRead + AsyncWrite + Unpin + fmt::Debug + 'static, { type Request = Connection; @@ -93,8 +88,9 @@ impl Clone for OpensslConnectorService { } } -impl Service for OpensslConnectorService +impl Service for OpensslConnectorService where + T: Address + 'static, U: AsyncRead + AsyncWrite + Unpin + fmt::Debug + 'static, { type Request = Connection; @@ -129,7 +125,7 @@ pub struct ConnectAsyncExt { _t: PhantomData, } -impl Future for ConnectAsyncExt +impl Future for ConnectAsyncExt where U: AsyncRead + AsyncWrite + Unpin + fmt::Debug + 'static, { @@ -196,7 +192,7 @@ impl Clone for OpensslConnectServiceFactory { } } -impl ServiceFactory for OpensslConnectServiceFactory { +impl ServiceFactory for OpensslConnectServiceFactory { type Request = Connect; type Response = SslStream; type Error = ConnectError; @@ -216,7 +212,7 @@ pub struct OpensslConnectService { openssl: OpensslConnectorService, } -impl Service for OpensslConnectService { +impl Service for OpensslConnectService { type Request = Connect; type Response = SslStream; type Error = ConnectError; @@ -235,13 +231,13 @@ impl Service for OpensslConnectService { } } -pub struct OpensslConnectServiceResponse { +pub struct OpensslConnectServiceResponse { fut1: Option< as Service>::Future>, fut2: Option< as Service>::Future>, openssl: OpensslConnectorService, } -impl Future for OpensslConnectServiceResponse { +impl Future for OpensslConnectServiceResponse { type Output = Result, ConnectError>; fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll { diff --git a/actix-connect/src/ssl/rustls.rs b/actix-connect/src/ssl/rustls.rs index c1145ae4..b5593420 100644 --- a/actix-connect/src/ssl/rustls.rs +++ b/actix-connect/src/ssl/rustls.rs @@ -33,13 +33,7 @@ where T: Address + Unpin, U: AsyncRead + AsyncWrite + Unpin + fmt::Debug, { - pub fn service( - connector: Arc, - ) -> impl Service< - Request = Connection, - Response = Connection>, - Error = std::io::Error, - > { + pub fn service(connector: Arc) -> RustlsConnectorService { RustlsConnectorService { connector: connector, _t: PhantomData, @@ -81,6 +75,15 @@ pub struct RustlsConnectorService { _t: PhantomData<(T, U)>, } +impl Clone for RustlsConnectorService { + fn clone(&self) -> Self { + Self { + connector: self.connector.clone(), + _t: PhantomData, + } + } +} + impl Service for RustlsConnectorService where U: AsyncRead + AsyncWrite + Unpin + fmt::Debug,