refactor(tests): update to newest tokio-timer
This commit is contained in:
@@ -11,7 +11,7 @@ use std::net::{TcpListener as StdTcpListener};
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::thread;
|
||||
use std::time::{Duration, Instant};
|
||||
use std::time::Duration;
|
||||
|
||||
use futures_channel::oneshot;
|
||||
use futures_core::ready;
|
||||
@@ -25,7 +25,6 @@ use tokio_net::driver::Handle;
|
||||
use tokio_net::tcp::{TcpListener, TcpStream as TkTcpStream};
|
||||
use tokio::runtime::current_thread::Runtime;
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
use tokio_timer::Delay;
|
||||
|
||||
use hyper::{Body, Request, Response, StatusCode, Version};
|
||||
use hyper::client::Client;
|
||||
@@ -938,7 +937,7 @@ fn disable_keep_alive_post_request() {
|
||||
// the read-blocked socket.
|
||||
//
|
||||
// See https://github.com/carllerche/mio/issues/776
|
||||
let timeout = Delay::new(Instant::now() + Duration::from_millis(10));
|
||||
let timeout = tokio_timer::sleep(Duration::from_millis(10));
|
||||
rt.block_on(timeout);
|
||||
assert!(dropped.load());
|
||||
child.join().unwrap();
|
||||
@@ -1007,7 +1006,7 @@ fn socket_half_closed() {
|
||||
.map_err(|_| unreachable!())
|
||||
.and_then(|socket| {
|
||||
Http::new().serve_connection(socket, service_fn(|_| {
|
||||
Delay::new(Instant::now() + Duration::from_millis(500))
|
||||
tokio_timer::sleep(Duration::from_millis(500))
|
||||
.map(|_| Ok::<_, hyper::Error>(Response::new(Body::empty())))
|
||||
}))
|
||||
});
|
||||
@@ -1035,7 +1034,7 @@ fn disconnect_after_reading_request_before_responding() {
|
||||
Http::new()
|
||||
.http1_half_close(false)
|
||||
.serve_connection(socket, service_fn(|_| {
|
||||
Delay::new(Instant::now() + Duration::from_secs(2))
|
||||
tokio_timer::sleep(Duration::from_secs(2))
|
||||
.map(|_| -> Result<Response<Body>, hyper::Error> {
|
||||
panic!("response future should have been dropped");
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user