Update futures and tokio alphas

This commit is contained in:
Sean McArthur
2019-08-29 14:25:17 -07:00
parent f4378bae58
commit 678c90eb0a
12 changed files with 32 additions and 27 deletions

View File

@@ -10,5 +10,5 @@ edition = "2018"
[dev-dependencies]
h2-support = { path = "../h2-support" }
log = "0.4.1"
futures-preview = "0.3.0-alpha.17"
tokio = "0.2.0-alpha.1"
futures-preview = "=0.3.0-alpha.18"
tokio = "=0.2.0-alpha.4"

View File

@@ -947,7 +947,6 @@ async fn settings_lowered_capacity_returns_capacity_to_connection() {
use futures::channel::oneshot;
use futures::future::{select, Either};
use std::time::Instant;
use tokio::timer::Delay;
let _ = env_logger::try_init();
let (io, mut srv) = mock::new();
@@ -979,7 +978,11 @@ async fn settings_lowered_capacity_returns_capacity_to_connection() {
//
// A timeout is used here to avoid blocking forever if there is a
// failure
let result = select(rx2, Delay::new(Instant::now() + Duration::from_secs(5))).await;
let result = select(
rx2,
tokio::timer::delay(Instant::now() + Duration::from_secs(5)),
)
.await;
if let Either::Right((_, _)) = result {
panic!("Timed out");
}
@@ -1011,7 +1014,11 @@ async fn settings_lowered_capacity_returns_capacity_to_connection() {
});
// Wait for server handshake to complete.
let result = select(rx1, Delay::new(Instant::now() + Duration::from_secs(5))).await;
let result = select(
rx1,
tokio::timer::delay(Instant::now() + Duration::from_secs(5)),
)
.await;
if let Either::Right((_, _)) = result {
panic!("Timed out");
}

View File

@@ -26,7 +26,10 @@ impl Server {
{
let mk_data = Arc::new(mk_data);
let listener = TcpListener::bind(&SocketAddr::from(([127, 0, 0, 1], 0))).unwrap();
let rt = tokio::runtime::Runtime::new().unwrap();
let listener = rt
.block_on(TcpListener::bind(SocketAddr::from(([127, 0, 0, 1], 0))))
.unwrap();
let addr = listener.local_addr().unwrap();
let reqs = Arc::new(AtomicUsize::new(0));
let reqs2 = reqs.clone();
@@ -44,7 +47,6 @@ impl Server {
}
};
let rt = tokio::runtime::Runtime::new().unwrap();
rt.block_on(server);
});