mirror of
https://github.com/fafhrd91/actix-net
synced 2024-11-30 17:44:34 +01:00
actix-connect: Minimize futures-*
dependencies
This commit is contained in:
parent
4be11b541b
commit
f955e49930
@ -37,7 +37,7 @@ actix-utils = "1.0.6"
|
|||||||
actix-rt = "1.0.0"
|
actix-rt = "1.0.0"
|
||||||
derive_more = "0.99.2"
|
derive_more = "0.99.2"
|
||||||
either = "1.5.3"
|
either = "1.5.3"
|
||||||
futures = "0.3.1"
|
futures-util = { version = "0.3.4", default-features = false }
|
||||||
http = { version = "0.2.0", optional = true }
|
http = { version = "0.2.0", optional = true }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
trust-dns-proto = { version = "0.19", default-features = false, features = ["tokio-runtime"] }
|
trust-dns-proto = { version = "0.19", default-features = false, features = ["tokio-runtime"] }
|
||||||
|
@ -8,7 +8,7 @@ use std::task::{Context, Poll};
|
|||||||
|
|
||||||
use actix_rt::net::TcpStream;
|
use actix_rt::net::TcpStream;
|
||||||
use actix_service::{Service, ServiceFactory};
|
use actix_service::{Service, ServiceFactory};
|
||||||
use futures::future::{err, ok, BoxFuture, Either, FutureExt, Ready};
|
use futures_util::future::{err, ok, BoxFuture, Either, FutureExt, Ready};
|
||||||
|
|
||||||
use super::connect::{Address, Connect, Connection};
|
use super::connect::{Address, Connect, Connection};
|
||||||
use super::error::ConnectError;
|
use super::error::ConnectError;
|
||||||
|
@ -5,7 +5,7 @@ use std::pin::Pin;
|
|||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
|
|
||||||
use actix_service::{Service, ServiceFactory};
|
use actix_service::{Service, ServiceFactory};
|
||||||
use futures::future::{ok, Either, Ready};
|
use futures_util::future::{ok, Either, Ready};
|
||||||
use trust_dns_resolver::TokioAsyncResolver as AsyncResolver;
|
use trust_dns_resolver::TokioAsyncResolver as AsyncResolver;
|
||||||
use trust_dns_resolver::{error::ResolveError, lookup_ip::LookupIp};
|
use trust_dns_resolver::{error::ResolveError, lookup_ip::LookupIp};
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ use std::task::{Context, Poll};
|
|||||||
use actix_rt::net::TcpStream;
|
use actix_rt::net::TcpStream;
|
||||||
use actix_service::{Service, ServiceFactory};
|
use actix_service::{Service, ServiceFactory};
|
||||||
use either::Either;
|
use either::Either;
|
||||||
use futures::future::{ok, Ready};
|
use futures_util::future::{ok, Ready};
|
||||||
use trust_dns_resolver::TokioAsyncResolver as AsyncResolver;
|
use trust_dns_resolver::TokioAsyncResolver as AsyncResolver;
|
||||||
|
|
||||||
use crate::connect::{Address, Connect, Connection};
|
use crate::connect::{Address, Connect, Connection};
|
||||||
|
@ -10,7 +10,7 @@ pub use tokio_openssl::{HandshakeError, SslStream};
|
|||||||
use actix_codec::{AsyncRead, AsyncWrite};
|
use actix_codec::{AsyncRead, AsyncWrite};
|
||||||
use actix_rt::net::TcpStream;
|
use actix_rt::net::TcpStream;
|
||||||
use actix_service::{Service, ServiceFactory};
|
use actix_service::{Service, ServiceFactory};
|
||||||
use futures::future::{err, ok, Either, FutureExt, LocalBoxFuture, Ready};
|
use futures_util::future::{err, ok, Either, FutureExt, LocalBoxFuture, Ready};
|
||||||
use trust_dns_resolver::TokioAsyncResolver as AsyncResolver;
|
use trust_dns_resolver::TokioAsyncResolver as AsyncResolver;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@ -243,7 +243,7 @@ impl<T: Address> Future for OpensslConnectServiceResponse<T> {
|
|||||||
|
|
||||||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
||||||
if let Some(ref mut fut) = self.fut1 {
|
if let Some(ref mut fut) = self.fut1 {
|
||||||
match futures::ready!(Pin::new(fut).poll(cx)) {
|
match futures_util::ready!(Pin::new(fut).poll(cx)) {
|
||||||
Ok(res) => {
|
Ok(res) => {
|
||||||
let _ = self.fut1.take();
|
let _ = self.fut1.take();
|
||||||
self.fut2 = Some(self.openssl.call(res));
|
self.fut2 = Some(self.openssl.call(res));
|
||||||
@ -253,7 +253,7 @@ impl<T: Address> Future for OpensslConnectServiceResponse<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Some(ref mut fut) = self.fut2 {
|
if let Some(ref mut fut) = self.fut2 {
|
||||||
match futures::ready!(Pin::new(fut).poll(cx)) {
|
match futures_util::ready!(Pin::new(fut).poll(cx)) {
|
||||||
Ok(connect) => Poll::Ready(Ok(connect.into_parts().0)),
|
Ok(connect) => Poll::Ready(Ok(connect.into_parts().0)),
|
||||||
Err(e) => Poll::Ready(Err(ConnectError::Io(io::Error::new(
|
Err(e) => Poll::Ready(Err(ConnectError::Io(io::Error::new(
|
||||||
io::ErrorKind::Other,
|
io::ErrorKind::Other,
|
||||||
|
@ -10,7 +10,7 @@ pub use tokio_rustls::{client::TlsStream, rustls::ClientConfig};
|
|||||||
|
|
||||||
use actix_codec::{AsyncRead, AsyncWrite};
|
use actix_codec::{AsyncRead, AsyncWrite};
|
||||||
use actix_service::{Service, ServiceFactory};
|
use actix_service::{Service, ServiceFactory};
|
||||||
use futures::future::{ok, Ready};
|
use futures_util::future::{ok, Ready};
|
||||||
use tokio_rustls::{Connect, TlsConnector};
|
use tokio_rustls::{Connect, TlsConnector};
|
||||||
use webpki::DNSNameRef;
|
use webpki::DNSNameRef;
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ where
|
|||||||
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();
|
||||||
Poll::Ready(
|
Poll::Ready(
|
||||||
futures::ready!(Pin::new(&mut this.fut).poll(cx)).map(|stream| {
|
futures_util::ready!(Pin::new(&mut this.fut).poll(cx)).map(|stream| {
|
||||||
let s = this.stream.take().unwrap();
|
let s = this.stream.take().unwrap();
|
||||||
trace!("SSL Handshake success: {:?}", s.host());
|
trace!("SSL Handshake success: {:?}", s.host());
|
||||||
s.replace(stream).1
|
s.replace(stream).1
|
||||||
|
@ -5,7 +5,7 @@ use actix_rt::net::TcpStream;
|
|||||||
use actix_service::{fn_service, Service, ServiceFactory};
|
use actix_service::{fn_service, Service, ServiceFactory};
|
||||||
use actix_testing::TestServer;
|
use actix_testing::TestServer;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use futures::SinkExt;
|
use futures_util::sink::SinkExt;
|
||||||
|
|
||||||
use actix_connect::resolver::{ResolverConfig, ResolverOpts};
|
use actix_connect::resolver::{ResolverConfig, ResolverOpts};
|
||||||
use actix_connect::Connect;
|
use actix_connect::Connect;
|
||||||
|
Loading…
Reference in New Issue
Block a user