1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-28 09:42:40 +01:00

fix connector

This commit is contained in:
Nikolay Kim 2018-05-27 05:18:37 -07:00
parent be2ceb7c66
commit fb582a6bca

View File

@ -222,8 +222,6 @@ impl SystemService for ClientConnector {}
impl Default for ClientConnector { impl Default for ClientConnector {
fn default() -> ClientConnector { fn default() -> ClientConnector {
let (tx, rx) = mpsc::unbounded();
#[cfg(all(feature = "alpn"))] #[cfg(all(feature = "alpn"))]
{ {
let builder = SslConnector::builder(SslMethod::tls()).unwrap(); let builder = SslConnector::builder(SslMethod::tls()).unwrap();
@ -231,6 +229,7 @@ impl Default for ClientConnector {
} }
#[cfg(all(feature = "tls", not(feature = "alpn")))] #[cfg(all(feature = "tls", not(feature = "alpn")))]
{ {
let (tx, rx) = mpsc::unbounded();
let builder = TlsConnector::builder().unwrap(); let builder = TlsConnector::builder().unwrap();
ClientConnector { ClientConnector {
stats: ClientConnectorStats::default(), stats: ClientConnectorStats::default(),
@ -253,22 +252,25 @@ impl Default for ClientConnector {
} }
#[cfg(not(any(feature = "alpn", feature = "tls")))] #[cfg(not(any(feature = "alpn", feature = "tls")))]
ClientConnector { {
stats: ClientConnectorStats::default(), let (tx, rx) = mpsc::unbounded();
subscriber: None, ClientConnector {
acq_tx: tx, stats: ClientConnectorStats::default(),
acq_rx: Some(rx), subscriber: None,
conn_lifetime: Duration::from_secs(75), acq_tx: tx,
conn_keep_alive: Duration::from_secs(15), acq_rx: Some(rx),
limit: 100, conn_lifetime: Duration::from_secs(75),
limit_per_host: 0, conn_keep_alive: Duration::from_secs(15),
acquired: 0, limit: 100,
acquired_per_host: HashMap::new(), limit_per_host: 0,
available: HashMap::new(), acquired: 0,
to_close: Vec::new(), acquired_per_host: HashMap::new(),
waiters: HashMap::new(), available: HashMap::new(),
wait_timeout: None, to_close: Vec::new(),
paused: Paused::No, waiters: HashMap::new(),
wait_timeout: None,
paused: Paused::No,
}
} }
} }
} }
@ -324,8 +326,8 @@ impl ClientConnector {
connector, connector,
stats: ClientConnectorStats::default(), stats: ClientConnectorStats::default(),
subscriber: None, subscriber: None,
pool_tx: tx, acq_tx: tx,
pool_rx: Some(rx), acq_rx: Some(rx),
conn_lifetime: Duration::from_secs(75), conn_lifetime: Duration::from_secs(75),
conn_keep_alive: Duration::from_secs(15), conn_keep_alive: Duration::from_secs(15),
limit: 100, limit: 100,