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

@@ -19,7 +19,6 @@ use std::sync::Arc;
use futures_util::{FutureExt, StreamExt};
use tokio_executor::TypedExecutor;
use tokio_sync::{mpsc, oneshot};
use tokio_threadpool;
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.
#[derive(Clone)]
pub struct GaiResolver {
tx: tokio_threadpool::Sender,
tx: tokio_executor::threadpool::Sender,
/// A handle to keep the threadpool alive until all `GaiResolver` clones
/// have been dropped.
_threadpool_keep_alive: ThreadPoolKeepAlive,
@@ -114,7 +113,7 @@ impl GaiResolver {
///
/// Takes number of DNS worker threads.
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")
// not for CPU tasks, so only spawn workers
// 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
/// multi-threaded Tokio runtime.
@@ -332,10 +331,10 @@ impl Future for TokioThreadpoolGaiFuture {
type Output = Result<GaiAddrs, io::Error>;
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(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))),
}
}

View File

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

View File

@@ -20,7 +20,7 @@ use futures_core::Stream;
use h2;
use pin_utils::{unsafe_pinned, unsafe_unpinned};
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::common::exec::{Exec, H2Exec, NewSvcExec};

View File

@@ -62,7 +62,6 @@ use std::fmt;
use futures_core::Stream;
use pin_utils::unsafe_pinned;
use tokio_io::{AsyncRead, AsyncWrite};
#[cfg(feature = "runtime")] use tokio_reactor;
use crate::body::{Body, Payload};
use crate::common::exec::{Exec, H2Exec, NewSvcExec};
@@ -132,7 +131,7 @@ impl Server<AddrIncoming, ()> {
/// Create a new instance from a `std::net::TcpListener` instance.
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)
.map(Server::builder)
}

View File

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