chore(dependencies): Upgrade tokio

This commit is contained in:
Douman
2019-08-18 14:16:25 +02:00
committed by Sean McArthur
parent c1d40f30b5
commit 4920f5e264
8 changed files with 28 additions and 34 deletions

View File

@@ -36,15 +36,13 @@ log = "0.4"
net2 = { version = "0.2.32", optional = true } net2 = { version = "0.2.32", optional = true }
pin-utils = "0.1.0-alpha.4" pin-utils = "0.1.0-alpha.4"
time = "0.1" time = "0.1"
tokio = { version = "0.2.0-alpha.1", optional = true, default-features = false, features = ["rt-full"] } tokio = { version = "0.2.0-alpha.2", optional = true, default-features = false, features = ["rt-full"] }
tokio-buf = "0.2.0-alpha.1" tokio-buf = "0.2.0-alpha.1"
tokio-executor = "0.2.0-alpha.1" tokio-executor = "0.2.0-alpha.2"
tokio-io = "0.2.0-alpha.1" tokio-io = "0.2.0-alpha.2"
tokio-reactor = { version = "0.2.0-alpha.1", optional = true } tokio-sync = "0.2.0-alpha.2"
tokio-sync = "0.2.0-alpha.1" tokio-net = { version = "0.2.0-alpha.2", optional = true, features = ["tcp"] }
tokio-tcp = { version = "0.2.0-alpha.1", optional = true, features = ["async-traits"] } tokio-timer = { version = "0.3.0-alpha.2", optional = true }
tokio-threadpool = { version = "0.2.0-alpha.1", optional = true }
tokio-timer = { version = "0.3.0-alpha.1", optional = true }
want = { git = "https://github.com/seanmonstar/want", branch = "std-future" } want = { git = "https://github.com/seanmonstar/want", branch = "std-future" }
[dev-dependencies] [dev-dependencies]
@@ -55,8 +53,8 @@ spmc = "0.3"
serde = "1.0" serde = "1.0"
serde_derive = "1.0" serde_derive = "1.0"
serde_json = "1.0" serde_json = "1.0"
tokio-fs = "0.2.0-alpha.1" tokio-fs = "0.2.0-alpha.2"
tokio-test = "0.2.0-alpha.1" tokio-test = "0.2.0-alpha.2"
url = "1.0" url = "1.0"
@@ -68,9 +66,7 @@ default = [
runtime = [ runtime = [
"net2", "net2",
"tokio", "tokio",
"tokio-reactor", "tokio-net",
"tokio-tcp",
"tokio-threadpool",
"tokio-timer", "tokio-timer",
] ]
nightly = [] nightly = []

View File

@@ -19,7 +19,6 @@ use std::sync::Arc;
use futures_util::{FutureExt, StreamExt}; use futures_util::{FutureExt, StreamExt};
use tokio_executor::TypedExecutor; use tokio_executor::TypedExecutor;
use tokio_sync::{mpsc, oneshot}; use tokio_sync::{mpsc, oneshot};
use tokio_threadpool;
use crate::common::{Future, Never, Pin, Poll, Unpin, task}; use crate::common::{Future, Never, Pin, Poll, Unpin, task};
@@ -42,7 +41,7 @@ pub struct Name {
/// A resolver using blocking `getaddrinfo` calls in a threadpool. /// A resolver using blocking `getaddrinfo` calls in a threadpool.
#[derive(Clone)] #[derive(Clone)]
pub struct GaiResolver { pub struct GaiResolver {
tx: tokio_threadpool::Sender, tx: tokio_executor::threadpool::Sender,
/// A handle to keep the threadpool alive until all `GaiResolver` clones /// A handle to keep the threadpool alive until all `GaiResolver` clones
/// have been dropped. /// have been dropped.
_threadpool_keep_alive: ThreadPoolKeepAlive, _threadpool_keep_alive: ThreadPoolKeepAlive,
@@ -114,7 +113,7 @@ impl GaiResolver {
/// ///
/// Takes number of DNS worker threads. /// Takes number of DNS worker threads.
pub fn new(threads: usize) -> Self { pub fn new(threads: usize) -> Self {
let pool = tokio_threadpool::Builder::new() let pool = tokio_executor::threadpool::Builder::new()
.name_prefix("hyper-dns-gai-resolver") .name_prefix("hyper-dns-gai-resolver")
// not for CPU tasks, so only spawn workers // not for CPU tasks, so only spawn workers
// in blocking mode // in blocking mode
@@ -296,7 +295,7 @@ impl Iterator for IpAddrs {
} }
} }
/// A resolver using `getaddrinfo` calls via the `tokio_threadpool::blocking` API. /// A resolver using `getaddrinfo` calls via the `tokio_executor::threadpool::blocking` API.
/// ///
/// Unlike the `GaiResolver` this will not spawn dedicated threads, but only works when running on the /// Unlike the `GaiResolver` this will not spawn dedicated threads, but only works when running on the
/// multi-threaded Tokio runtime. /// multi-threaded Tokio runtime.
@@ -332,10 +331,10 @@ impl Future for TokioThreadpoolGaiFuture {
type Output = Result<GaiAddrs, io::Error>; type Output = Result<GaiAddrs, io::Error>;
fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> { fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
match ready!(tokio_threadpool::blocking(|| (self.name.as_str(), 0).to_socket_addrs())) { match ready!(tokio_executor::threadpool::blocking(|| (self.name.as_str(), 0).to_socket_addrs())) {
Ok(Ok(iter)) => Poll::Ready(Ok(GaiAddrs { inner: IpAddrs { iter } })), Ok(Ok(iter)) => Poll::Ready(Ok(GaiAddrs { inner: IpAddrs { iter } })),
Ok(Err(e)) => Poll::Ready(Err(e)), Ok(Err(e)) => Poll::Ready(Err(e)),
// a BlockingError, meaning not on a tokio_threadpool :( // a BlockingError, meaning not on a tokio_executor::threadpool :(
Err(e) => Poll::Ready(Err(io::Error::new(io::ErrorKind::Other, e))), Err(e) => Poll::Ready(Err(io::Error::new(io::ErrorKind::Other, e))),
} }
} }

View File

@@ -8,8 +8,8 @@ use std::time::{Duration, Instant};
use http::uri::Scheme; use http::uri::Scheme;
use net2::TcpBuilder; use net2::TcpBuilder;
use tokio_reactor::Handle; use tokio_net::driver::Handle;
use tokio_tcp::{TcpStream/*, ConnectFuture*/}; use tokio_net::tcp::{TcpStream/*, ConnectFuture*/};
use tokio_timer::Delay; use tokio_timer::Delay;
use crate::common::{Future, Pin, Poll, task}; use crate::common::{Future, Pin, Poll, task};
@@ -623,7 +623,7 @@ mod tests {
use futures::{Async, Poll}; use futures::{Async, Poll};
use tokio::runtime::current_thread::Runtime; use tokio::runtime::current_thread::Runtime;
use tokio_reactor::Handle; use tokio_net::driver::Handle;
use super::dns; use super::dns;
use super::ConnectingTcp; use super::ConnectingTcp;

View File

@@ -20,7 +20,7 @@ use futures_core::Stream;
use h2; use h2;
use pin_utils::{unsafe_pinned, unsafe_unpinned}; use pin_utils::{unsafe_pinned, unsafe_unpinned};
use tokio_io::{AsyncRead, AsyncWrite}; use tokio_io::{AsyncRead, AsyncWrite};
#[cfg(feature = "runtime")] use tokio_reactor::Handle; #[cfg(feature = "runtime")] use tokio_net::driver::Handle;
use crate::body::{Body, Payload}; use crate::body::{Body, Payload};
use crate::common::exec::{Exec, H2Exec, NewSvcExec}; use crate::common::exec::{Exec, H2Exec, NewSvcExec};

View File

@@ -62,7 +62,6 @@ use std::fmt;
use futures_core::Stream; use futures_core::Stream;
use pin_utils::unsafe_pinned; use pin_utils::unsafe_pinned;
use tokio_io::{AsyncRead, AsyncWrite}; use tokio_io::{AsyncRead, AsyncWrite};
#[cfg(feature = "runtime")] use tokio_reactor;
use crate::body::{Body, Payload}; use crate::body::{Body, Payload};
use crate::common::exec::{Exec, H2Exec, NewSvcExec}; use crate::common::exec::{Exec, H2Exec, NewSvcExec};
@@ -132,7 +131,7 @@ impl Server<AddrIncoming, ()> {
/// Create a new instance from a `std::net::TcpListener` instance. /// Create a new instance from a `std::net::TcpListener` instance.
pub fn from_tcp(listener: StdTcpListener) -> Result<Builder<AddrIncoming>, crate::Error> { pub fn from_tcp(listener: StdTcpListener) -> Result<Builder<AddrIncoming>, crate::Error> {
let handle = tokio_reactor::Handle::default(); let handle = tokio_net::driver::Handle::default();
AddrIncoming::from_std(listener, &handle) AddrIncoming::from_std(listener, &handle)
.map(Server::builder) .map(Server::builder)
} }

View File

@@ -5,8 +5,8 @@ use std::time::{Duration, Instant};
use futures_core::Stream; use futures_core::Stream;
use futures_util::FutureExt as _; use futures_util::FutureExt as _;
use tokio_reactor::Handle; use tokio_net::driver::Handle;
use tokio_tcp::TcpListener; use tokio_net::tcp::TcpListener;
use tokio_timer::Delay; use tokio_timer::Delay;
use crate::common::{Future, Pin, Poll, task}; use crate::common::{Future, Pin, Poll, task};
@@ -196,7 +196,7 @@ mod addr_stream {
use std::io; use std::io;
use std::net::SocketAddr; use std::net::SocketAddr;
use bytes::{Buf, BufMut}; use bytes::{Buf, BufMut};
use tokio_tcp::TcpStream; use tokio_net::tcp::TcpStream;
use tokio_io::{AsyncRead, AsyncWrite}; use tokio_io::{AsyncRead, AsyncWrite};
use crate::common::{Pin, Poll, task}; use crate::common::{Pin, Poll, task};

View File

@@ -7,7 +7,7 @@ extern crate net2;
extern crate pretty_env_logger; extern crate pretty_env_logger;
extern crate tokio; extern crate tokio;
extern crate tokio_io; extern crate tokio_io;
extern crate tokio_tcp; extern crate tokio_net;
extern crate tokio_timer; extern crate tokio_timer;
use std::io::{Read, Write}; use std::io::{Read, Write};
@@ -25,7 +25,7 @@ use futures_util::future::{self, FutureExt};
use futures_util::try_future::{self, TryFutureExt}; use futures_util::try_future::{self, TryFutureExt};
use futures_util::try_stream::TryStreamExt; use futures_util::try_stream::TryStreamExt;
use tokio::runtime::current_thread::Runtime; use tokio::runtime::current_thread::Runtime;
use tokio_tcp::TcpStream; use tokio_net::tcp::TcpStream;
fn s(buf: &[u8]) -> &str { fn s(buf: &[u8]) -> &str {
::std::str::from_utf8(buf).expect("from_utf8") ::std::str::from_utf8(buf).expect("from_utf8")
@@ -773,7 +773,7 @@ mod dispatch_impl {
use futures_util::try_stream::TryStreamExt; use futures_util::try_stream::TryStreamExt;
use tokio::runtime::current_thread::Runtime; use tokio::runtime::current_thread::Runtime;
use tokio_io::{AsyncRead, AsyncWrite}; use tokio_io::{AsyncRead, AsyncWrite};
use tokio_tcp::TcpStream; use tokio_net::tcp::TcpStream;
use tokio_timer::Delay; use tokio_timer::Delay;
use hyper::client::connect::{Connect, Connected, Destination, HttpConnector}; use hyper::client::connect::{Connect, Connected, Destination, HttpConnector};
@@ -1635,7 +1635,7 @@ mod conn {
use futures_util::try_stream::TryStreamExt; use futures_util::try_stream::TryStreamExt;
use tokio::runtime::current_thread::Runtime; use tokio::runtime::current_thread::Runtime;
use tokio_io::{AsyncRead, AsyncWrite}; use tokio_io::{AsyncRead, AsyncWrite};
use tokio_tcp::TcpStream; use tokio_net::tcp::TcpStream;
use tokio_timer::Delay; use tokio_timer::Delay;
use hyper::{self, Request, Body, Method}; use hyper::{self, Request, Body, Method};

View File

@@ -10,7 +10,7 @@ extern crate spmc;
extern crate pretty_env_logger; extern crate pretty_env_logger;
extern crate tokio; extern crate tokio;
extern crate tokio_io; extern crate tokio_io;
extern crate tokio_tcp; extern crate tokio_net;
use std::net::{TcpStream, Shutdown, SocketAddr}; use std::net::{TcpStream, Shutdown, SocketAddr};
use std::io::{self, Read, Write}; use std::io::{self, Read, Write};
@@ -26,7 +26,7 @@ use futures::future::{self, FutureResult, Either};
use futures::sync::oneshot; use futures::sync::oneshot;
use futures_timer::Delay; use futures_timer::Delay;
use http::header::{HeaderName, HeaderValue}; use http::header::{HeaderName, HeaderValue};
use tokio_tcp::{TcpListener, TcpStream as TkTcpStream}; use tokio_net::tcp::{TcpListener, TcpStream as TkTcpStream};
use tokio::runtime::current_thread::Runtime; use tokio::runtime::current_thread::Runtime;
use tokio::reactor::Handle; use tokio::reactor::Handle;
use tokio_io::{AsyncRead, AsyncWrite}; use tokio_io::{AsyncRead, AsyncWrite};