Reduce futures optional features (#737)

This commit is contained in:
Sean McArthur
2019-12-12 12:34:44 -08:00
committed by GitHub
parent be52c4d558
commit a57afd50ea
2 changed files with 6 additions and 35 deletions

View File

@@ -1,4 +1,3 @@
use futures_util::FutureExt;
use hyper::service::Service;
use http::uri::{Scheme, Authority};
use http::Uri;
@@ -413,48 +412,20 @@ impl Service<Uri> for Connector
let timeout = self.timeout;
for prox in self.proxies.iter() {
if let Some(proxy_scheme) = prox.intercept(&dst) {
return with_timeout(
return Box::pin(with_timeout(
self.clone().connect_via_proxy(dst, proxy_scheme),
timeout,
)
.boxed();
));
}
}
with_timeout(
Box::pin(with_timeout(
self.clone().connect_with_maybe_proxy(dst, false),
timeout,
)
.boxed()
))
}
}
//impl Connect for Connector {
// type Transport = Conn;
// type Error = BoxError;
// type Future = Connecting;
//
// fn connect(&self, dst: Uri) -> Self::Future {
// let timeout = self.timeout;
// for prox in self.proxies.iter() {
// if let Some(proxy_scheme) = prox.intercept(&dst) {
// return with_timeout(
// self.clone().connect_via_proxy(dst, proxy_scheme),
// timeout,
// )
// .boxed();
// }
// }
//
// with_timeout(
// self.clone().connect_with_maybe_proxy(dst, false),
// timeout,
// )
// .boxed()
// }
//}
pub(crate) trait AsyncConn: AsyncRead + AsyncWrite + Connection {}
impl<T: AsyncRead + AsyncWrite + Connection> AsyncConn for T {}