Update to Tokio and Bytes 1.0 (#504)

This commit is contained in:
Sean McArthur
2020-12-23 10:01:44 -08:00
committed by GitHub
parent dc3079ab89
commit b4976675fa
10 changed files with 38 additions and 32 deletions

View File

@@ -11,5 +11,5 @@ h2 = { path = "../.." }
env_logger = { version = "0.5.3", default-features = false }
futures = { version = "0.3", default-features = false, features = ["std"] }
honggfuzz = "0.5"
http = { git = "https://github.com/paolobarbolini/http.git", branch = "bytes06" }
tokio = { version = "0.3.2", features = [] }
http = "0.2"
tokio = "1"

View File

@@ -7,10 +7,10 @@ edition = "2018"
[dependencies]
h2 = { path = "../..", features = ["stream", "unstable"] }
bytes = "0.6"
bytes = "1"
tracing = "0.1"
tracing-subscriber = { version = "0.2", default-features = false, features = ["fmt", "chrono", "ansi"] }
futures = { version = "0.3", default-features = false }
http = "0.2"
tokio = { version = "0.3.2", features = ["time"] }
tokio-test = "0.3"
tokio = { version = "1", features = ["time"] }
tokio-test = "0.4"

View File

@@ -147,7 +147,7 @@ impl Handle {
poll_fn(move |cx| {
while buf.has_remaining() {
let res = Pin::new(self.codec.get_mut())
.poll_write(cx, &mut buf.bytes())
.poll_write(cx, &mut buf.chunk())
.map_err(|e| panic!("write err={:?}", e));
let n = ready!(res).unwrap();

View File

@@ -11,4 +11,4 @@ edition = "2018"
h2-support = { path = "../h2-support" }
tracing = "0.1.13"
futures = { version = "0.3", default-features = false, features = ["alloc"] }
tokio = { version = "0.3.2", features = ["macros", "net", "rt", "io-util"] }
tokio = { version = "1", features = ["macros", "net", "rt", "io-util"] }

View File

@@ -940,7 +940,6 @@ async fn recv_no_init_window_then_receive_some_init_window() {
#[tokio::test]
async fn settings_lowered_capacity_returns_capacity_to_connection() {
use futures::channel::oneshot;
use futures::future::{select, Either};
h2_support::trace_init!();
let (io, mut srv) = mock::new();
@@ -972,10 +971,9 @@ 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, tokio::time::sleep(Duration::from_secs(5))).await;
if let Either::Right((_, _)) = result {
panic!("Timed out");
}
let _ = tokio::time::timeout(Duration::from_secs(5), rx2)
.await
.unwrap();
idle_ms(500).await;
@@ -1004,10 +1002,9 @@ async fn settings_lowered_capacity_returns_capacity_to_connection() {
});
// Wait for server handshake to complete.
let result = select(rx1, tokio::time::sleep(Duration::from_secs(5))).await;
if let Either::Right((_, _)) = result {
panic!("Timed out");
}
let _ = tokio::time::timeout(Duration::from_secs(5), rx1)
.await
.unwrap();
let request = Request::post("https://example.com/one").body(()).unwrap();