From d7d3355ef37b0b525a6e89c70317b58dac9c44a5 Mon Sep 17 00:00:00 2001 From: Frando Date: Thu, 29 Aug 2024 10:26:31 +0200 Subject: [PATCH] fix: fixes after merging main --- Cargo.lock | 177 ++++++++-------------------------- Cargo.toml | 6 +- iroh-net/src/endpoint.rs | 4 +- iroh-willow/Cargo.toml | 1 - iroh-willow/examples/bench.rs | 9 +- iroh-willow/src/net.rs | 11 ++- iroh-willow/tests/basic.rs | 9 +- 7 files changed, 62 insertions(+), 155 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 637c2db057..ea0b727ea5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -351,8 +351,8 @@ dependencies = [ "hyper 1.4.1", "hyper-util", "pin-project-lite", - "rustls 0.23.11", - "rustls-pemfile 2.1.2", + "rustls", + "rustls-pemfile", "rustls-pki-types", "tokio", "tokio-rustls", @@ -2025,8 +2025,8 @@ dependencies = [ "once_cell", "rand", "ring", - "rustls 0.23.11", - "rustls-pemfile 2.1.2", + "rustls", + "rustls-pemfile", "serde", "thiserror", "time", @@ -2074,7 +2074,7 @@ dependencies = [ "parking_lot", "rand", "resolv-conf", - "rustls 0.23.11", + "rustls", "serde", "smallvec", "thiserror", @@ -2099,7 +2099,7 @@ dependencies = [ "hickory-resolver", "ipnet", "prefix-trie", - "rustls 0.23.11", + "rustls", "serde", "thiserror", "time", @@ -2302,7 +2302,7 @@ dependencies = [ "http 1.1.0", "hyper 1.4.1", "hyper-util", - "rustls 0.23.11", + "rustls", "rustls-pki-types", "tokio", "tokio-rustls", @@ -2507,7 +2507,7 @@ dependencies = [ "iroh-io", "iroh-metrics", "iroh-net", - "iroh-quinn 0.11.3", + "iroh-quinn", "iroh-test", "iroh-willow", "nested_enum_utils", @@ -2604,7 +2604,7 @@ dependencies = [ "iroh-io", "iroh-metrics", "iroh-net", - "iroh-quinn 0.11.3", + "iroh-quinn", "iroh-test", "num_cpus", "oneshot", @@ -2618,7 +2618,7 @@ dependencies = [ "redb 1.5.1", "redb 2.1.1", "reflink-copy", - "rustls 0.23.11", + "rustls", "self_cell", "serde", "serde_json", @@ -2719,8 +2719,8 @@ dependencies = [ "rcgen", "redb 2.1.1", "regex", - "rustls 0.23.11", - "rustls-pemfile 2.1.2", + "rustls", + "rustls-pemfile", "serde", "struct_iterable", "strum 0.26.3", @@ -2798,7 +2798,7 @@ dependencies = [ "iroh-blake3", "iroh-metrics", "iroh-net", - "iroh-quinn 0.11.3", + "iroh-quinn", "iroh-test", "postcard", "rand", @@ -2878,9 +2878,9 @@ dependencies = [ "iroh-base", "iroh-metrics", "iroh-net", - "iroh-quinn 0.11.3", - "iroh-quinn-proto 0.11.6", - "iroh-quinn-udp 0.5.4", + "iroh-quinn", + "iroh-quinn-proto", + "iroh-quinn-udp", "iroh-test", "libc", "mainline", @@ -2905,9 +2905,9 @@ dependencies = [ "reqwest", "ring", "rtnetlink", - "rustls 0.23.11", - "rustls-pemfile 2.1.2", - "rustls-webpki 0.102.6", + "rustls", + "rustls-pemfile", + "rustls-webpki", "serde", "serde_json", "serde_with", @@ -2952,32 +2952,15 @@ dependencies = [ "hdrhistogram", "iroh-metrics", "iroh-net", - "iroh-quinn 0.11.3", + "iroh-quinn", "rcgen", - "rustls 0.23.11", + "rustls", "socket2", "tokio", "tracing", "tracing-subscriber", ] -[[package]] -name = "iroh-quinn" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "906875956feb75d3d41d708ddaffeb11fdb10cd05f23efbcb17600037e411779" -dependencies = [ - "bytes", - "iroh-quinn-proto 0.10.8", - "iroh-quinn-udp 0.4.2", - "pin-project-lite", - "rustc-hash 1.1.0", - "rustls 0.21.12", - "thiserror", - "tokio", - "tracing", -] - [[package]] name = "iroh-quinn" version = "0.11.3" @@ -2985,35 +2968,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fd590a39a14cfc168efa4d894de5039d65641e62d8da4a80733018ababe3c33" dependencies = [ "bytes", - "iroh-quinn-proto 0.11.6", - "iroh-quinn-udp 0.5.4", + "iroh-quinn-proto", + "iroh-quinn-udp", "pin-project-lite", "rustc-hash 2.0.0", - "rustls 0.23.11", + "rustls", "socket2", "thiserror", "tokio", "tracing", ] -[[package]] -name = "iroh-quinn-proto" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6bf92478805e67f2320459285496e1137edf5171411001a0d4d85f9bbafb792" -dependencies = [ - "bytes", - "rand", - "ring", - "rustc-hash 1.1.0", - "rustls 0.21.12", - "rustls-native-certs 0.6.3", - "slab", - "thiserror", - "tinyvec", - "tracing", -] - [[package]] name = "iroh-quinn-proto" version = "0.11.6" @@ -3024,7 +2989,7 @@ dependencies = [ "rand", "ring", "rustc-hash 2.0.0", - "rustls 0.23.11", + "rustls", "rustls-platform-verifier", "slab", "thiserror", @@ -3032,19 +2997,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "iroh-quinn-udp" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edc7915b3a31f08ee0bc02f73f4d61a5d5be146a1081ef7f70622a11627fd314" -dependencies = [ - "bytes", - "libc", - "socket2", - "tracing", - "windows-sys 0.48.0", -] - [[package]] name = "iroh-quinn-udp" version = "0.5.4" @@ -3088,7 +3040,6 @@ dependencies = [ "iroh-io", "iroh-metrics", "iroh-net", - "iroh-quinn 0.10.5", "iroh-test", "meadowcap", "postcard", @@ -4330,7 +4281,7 @@ dependencies = [ "futures-sink", "futures-util", "hex", - "iroh-quinn 0.11.3", + "iroh-quinn", "pin-project", "serde", "slab", @@ -4369,7 +4320,7 @@ dependencies = [ "quinn-proto", "quinn-udp", "rustc-hash 1.1.0", - "rustls 0.23.11", + "rustls", "thiserror", "tokio", "tracing", @@ -4385,7 +4336,7 @@ dependencies = [ "rand", "ring", "rustc-hash 1.1.0", - "rustls 0.23.11", + "rustls", "slab", "thiserror", "tinyvec", @@ -4703,8 +4654,8 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.11", - "rustls-pemfile 2.1.2", + "rustls", + "rustls-pemfile", "rustls-pki-types", "serde", "serde_json", @@ -4844,17 +4795,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "rustls" -version = "0.21.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" -dependencies = [ - "ring", - "rustls-webpki 0.101.7", - "sct", -] - [[package]] name = "rustls" version = "0.23.11" @@ -4865,23 +4805,11 @@ dependencies = [ "once_cell", "ring", "rustls-pki-types", - "rustls-webpki 0.102.6", + "rustls-webpki", "subtle", "zeroize", ] -[[package]] -name = "rustls-native-certs" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" -dependencies = [ - "openssl-probe", - "rustls-pemfile 1.0.4", - "schannel", - "security-framework", -] - [[package]] name = "rustls-native-certs" version = "0.7.3" @@ -4889,21 +4817,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" dependencies = [ "openssl-probe", - "rustls-pemfile 2.1.2", + "rustls-pemfile", "rustls-pki-types", "schannel", "security-framework", ] -[[package]] -name = "rustls-pemfile" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" -dependencies = [ - "base64 0.21.7", -] - [[package]] name = "rustls-pemfile" version = "2.1.2" @@ -4931,10 +4850,10 @@ dependencies = [ "jni", "log", "once_cell", - "rustls 0.23.11", - "rustls-native-certs 0.7.3", + "rustls", + "rustls-native-certs", "rustls-platform-verifier-android", - "rustls-webpki 0.102.6", + "rustls-webpki", "security-framework", "security-framework-sys", "webpki-roots", @@ -4947,16 +4866,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" -[[package]] -name = "rustls-webpki" -version = "0.101.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "rustls-webpki" version = "0.102.6" @@ -5048,16 +4957,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "sct" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "sec1" version = "0.7.3" @@ -5932,7 +5831,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.11", + "rustls", "rustls-pki-types", "tokio", ] @@ -5955,7 +5854,7 @@ dependencies = [ "rcgen", "reqwest", "ring", - "rustls 0.23.11", + "rustls", "serde", "serde_json", "thiserror", @@ -6383,7 +6282,7 @@ dependencies = [ "base64 0.22.1", "log", "once_cell", - "rustls 0.23.11", + "rustls", "rustls-pki-types", "url", "webpki-roots", diff --git a/Cargo.toml b/Cargo.toml index a5b7ef6c84..e999e16d4b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ debug = true [profile.dev-ci] inherits = 'dev' -opt-level = 1 +opt-level = 1 [profile.optimized-release] inherits = 'release' @@ -51,5 +51,5 @@ unused-async = "warn" # willow-encoding = { path = "../willow-rs/encoding" } # meadowcap = { path = "../willow-rs/meadowcap" } willow-data-model = { git = "https://github.com/n0-computer/willow-rs.git", branch = "iroh-dev" } -willow-encoding = { git = "https://github.com/n0-computer/willow-rs.git", branch = "iroh-dev" } -meadowcap = { git = "https://github.com/n0-computer/willow-rs.git", branch = "iroh-dev" } +willow-encoding = { git = "https://github.com/n0-computer/willow-rs.git", branch = "iroh-dev" } +meadowcap = { git = "https://github.com/n0-computer/willow-rs.git", branch = "iroh-dev" } diff --git a/iroh-net/src/endpoint.rs b/iroh-net/src/endpoint.rs index 9e3644cabc..def2c14786 100644 --- a/iroh-net/src/endpoint.rs +++ b/iroh-net/src/endpoint.rs @@ -39,8 +39,8 @@ mod rtt_actor; use self::rtt_actor::RttMessage; pub use quinn::{ - ApplicationClose, Connection, ConnectionClose, ConnectionError, ReadError, RecvStream, - RetryError, SendStream, ServerConfig, TransportConfig, VarInt, WriteError, + ApplicationClose, Connection, ConnectionClose, ConnectionError, ReadError, ReadExactError, + RecvStream, RetryError, SendStream, ServerConfig, TransportConfig, VarInt, WriteError, }; pub use super::magicsock::{ diff --git a/iroh-willow/Cargo.toml b/iroh-willow/Cargo.toml index dc9c3ad489..f2ccc03527 100644 --- a/iroh-willow/Cargo.toml +++ b/iroh-willow/Cargo.toml @@ -33,7 +33,6 @@ iroh-metrics = { version = "0.23.0", path = "../iroh-metrics", optional = true } iroh-net = { version = "0.23.0", path = "../iroh-net" } meadowcap = "0.1.0" postcard = { version = "1", default-features = false, features = [ "alloc", "use-std", "experimental-derive", ] } -quinn = { package = "iroh-quinn", version = "0.10.5" } rand = "0.8.5" rand_core = "0.6.4" redb = { version = "2.0.0" } diff --git a/iroh-willow/examples/bench.rs b/iroh-willow/examples/bench.rs index d24e2b8c60..1e08017d76 100644 --- a/iroh-willow/examples/bench.rs +++ b/iroh-willow/examples/bench.rs @@ -146,14 +146,17 @@ mod util { let engine = engine.clone(); let endpoint = endpoint.clone(); async move { - while let Some(mut conn) = endpoint.accept().await { - let Ok(alpn) = conn.alpn().await else { + while let Some(incoming) = endpoint.accept().await { + let Ok(mut connecting) = incoming.accept() else { + continue; + }; + let Ok(alpn) = connecting.alpn().await else { continue; }; if alpn != ALPN { continue; } - let Ok(conn) = conn.await else { + let Ok(conn) = connecting.await else { continue; }; engine.handle_connection(conn).await?; diff --git a/iroh-willow/src/net.rs b/iroh-willow/src/net.rs index e2b1a6f45b..c0e2bc9cef 100644 --- a/iroh-willow/src/net.rs +++ b/iroh-willow/src/net.rs @@ -6,8 +6,9 @@ use anyhow::{anyhow, ensure, Context as _, Result}; use futures_concurrency::future::TryJoin; use futures_util::future::TryFutureExt; use iroh_base::key::NodeId; -use iroh_net::endpoint::{Connection, ConnectionError, ReadError, RecvStream, SendStream, VarInt}; -use quinn::ReadExactError; +use iroh_net::endpoint::{ + Connection, ConnectionError, ReadError, ReadExactError, RecvStream, SendStream, VarInt, +}; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tracing::{debug, trace}; @@ -293,7 +294,9 @@ async fn send_loop( // trace!(len, "sent"); } trace!(?channel, "send: close writer"); - send_stream.finish().await?; + send_stream.finish()?; + // We don't await SendStream::stopped, because we rely on application level closing notifiations, + // and make sure that the connection is closed gracefully in any case. trace!(?channel, "send: done"); Ok(()) } @@ -323,7 +326,7 @@ pub(crate) async fn terminate_gracefully(conn: &Connection) -> Result<()> { // Send a single byte on a newly opened uni stream. let mut send_stream = conn.open_uni().await?; send_stream.write_u8(1).await?; - send_stream.finish().await?; + send_stream.finish()?; // Wait until we either receive the goodbye byte from the other peer, or for the other peer // to close the connection with the expected error code. match tokio::time::timeout(SHUTDOWN_TIMEOUT, wait_for_goodbye_or_graceful_close(conn)).await { diff --git a/iroh-willow/tests/basic.rs b/iroh-willow/tests/basic.rs index 30afa0b3fd..7b4b679bfe 100644 --- a/iroh-willow/tests/basic.rs +++ b/iroh-willow/tests/basic.rs @@ -332,14 +332,17 @@ mod util { let engine = engine.clone(); let endpoint = endpoint.clone(); async move { - while let Some(mut conn) = endpoint.accept().await { - let Ok(alpn) = conn.alpn().await else { + while let Some(incoming) = endpoint.accept().await { + let Ok(mut connecting) = incoming.accept() else { + continue; + }; + let Ok(alpn) = connecting.alpn().await else { continue; }; if alpn != ALPN { continue; } - let Ok(conn) = conn.await else { + let Ok(conn) = connecting.await else { continue; }; engine.handle_connection(conn).await?;