From b999ab27a3f9b5cf9b42459256f6937f2438a7a8 Mon Sep 17 00:00:00 2001 From: fakeshadow <24548779@qq.com> Date: Sun, 21 Feb 2021 13:54:03 -0800 Subject: [PATCH] fix no default feature --- actix-http/src/client/connection.rs | 2 +- actix-http/src/client/connector.rs | 29 +++++++++++++++++++---------- actix-http/src/client/pool.rs | 2 +- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/actix-http/src/client/connection.rs b/actix-http/src/client/connection.rs index fcbbf1c92..97ecd0515 100644 --- a/actix-http/src/client/connection.rs +++ b/actix-http/src/client/connection.rs @@ -187,7 +187,7 @@ impl IoConnection { } #[allow(dead_code)] -pub enum EitherIoConnection +pub(crate) enum EitherIoConnection where A: AsyncRead + AsyncWrite + Unpin + 'static, B: AsyncRead + AsyncWrite + Unpin + 'static, diff --git a/actix-http/src/client/connector.rs b/actix-http/src/client/connector.rs index 138808613..8aa5b1319 100644 --- a/actix-http/src/client/connector.rs +++ b/actix-http/src/client/connector.rs @@ -15,7 +15,7 @@ use actix_utils::timeout::{TimeoutError, TimeoutService}; use http::Uri; use super::config::ConnectorConfig; -use super::connection::EitherIoConnection; +use super::connection::{Connection, EitherIoConnection}; use super::error::ConnectError; use super::pool::{ConnectionPool, Protocol}; use super::Connect; @@ -245,12 +245,8 @@ where /// its combinator chain. pub fn finish( self, - ) -> InnerConnector< - impl Service, - impl Service, Protocol), Error = ConnectError>, - U, - Box, - > { + ) -> impl Service + Clone + { let tcp_service = TimeoutService::new( self.config.timeout, apply_fn(self.connector.clone(), |msg: Connect, srv| { @@ -266,7 +262,20 @@ where #[cfg(not(any(feature = "openssl", feature = "rustls")))] { - InnerConnector { + // A dummy service for annotate tls pool's type signature. + pub type DummyService = Box< + dyn Service< + Connect, + Response = (Box, Protocol), + Error = ConnectError, + Future = futures_core::future::LocalBoxFuture< + 'static, + Result<(Box, Protocol), ConnectError>, + >, + >, + >; + + InnerConnector::<_, DummyService, _, Box> { tcp_pool: ConnectionPool::new( tcp_service, self.config.no_disconnect_timeout(), @@ -348,7 +357,7 @@ where } } -pub struct InnerConnector +struct InnerConnector where S1: Service + 'static, S2: Service + 'static, @@ -401,7 +410,7 @@ where } #[pin_project::pin_project(project = InnerConnectorProj)] -pub enum InnerConnectorResponse +enum InnerConnectorResponse where S1: Service + 'static, S2: Service + 'static, diff --git a/actix-http/src/client/pool.rs b/actix-http/src/client/pool.rs index c93670d8e..3800696fa 100644 --- a/actix-http/src/client/pool.rs +++ b/actix-http/src/client/pool.rs @@ -45,7 +45,7 @@ impl From for Key { } /// Connections pool for reuse Io type for certain [`http::uri::Authority`] as key. -pub struct ConnectionPool +pub(crate) struct ConnectionPool where Io: AsyncWrite + Unpin + 'static, {