From ba0bb88128819a1cd75b43465639a395cbb8dec5 Mon Sep 17 00:00:00 2001 From: Max Whitehead <35712032+MaxCWhitehead@users.noreply.github.com> Date: Sat, 26 Oct 2024 12:27:51 -0700 Subject: [PATCH] chore(deps): Update iroh-net 0.27 + move to workspace dep (#487) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This update should fix #428 🥳 --- Cargo.lock | 90 +++++++------------ Cargo.toml | 1 + framework_crates/bones_framework/Cargo.toml | 2 +- .../bones_framework/src/networking/online.rs | 2 +- other_crates/bones_matchmaker/Cargo.toml | 2 +- .../bones_matchmaker/src/matchmaker.rs | 13 ++- .../bones_matchmaker_proto/Cargo.toml | 2 +- 7 files changed, 46 insertions(+), 66 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 902d27aa51..dad1b44b79 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -421,6 +421,12 @@ dependencies = [ "critical-section", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "atomicell" version = "0.2.0" @@ -3398,16 +3404,16 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.26" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" dependencies = [ + "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "futures-util", - "http 0.2.12", + "http 1.1.0", "indexmap 2.5.0", "slab", "tokio", @@ -3648,17 +3654,6 @@ dependencies = [ "itoa", ] -[[package]] -name = "http-body" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" -dependencies = [ - "bytes", - "http 0.2.12", - "pin-project-lite", -] - [[package]] name = "http-body" version = "1.0.1" @@ -3678,7 +3673,7 @@ dependencies = [ "bytes", "futures-util", "http 1.1.0", - "http-body 1.0.1", + "http-body", "pin-project-lite", ] @@ -3700,30 +3695,6 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" -[[package]] -name = "hyper" -version = "0.14.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http 0.2.12", - "http-body 0.4.6", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2 0.5.7", - "tokio", - "tower-service", - "tracing", - "want", -] - [[package]] name = "hyper" version = "1.4.1" @@ -3733,8 +3704,9 @@ dependencies = [ "bytes", "futures-channel", "futures-util", + "h2", "http 1.1.0", - "http-body 1.0.1", + "http-body", "httparse", "httpdate", "itoa", @@ -3752,7 +3724,7 @@ checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", "http 1.1.0", - "hyper 1.4.1", + "hyper", "hyper-util", "rustls 0.23.12", "rustls-pki-types", @@ -3772,8 +3744,8 @@ dependencies = [ "futures-channel", "futures-util", "http 1.1.0", - "http-body 1.0.1", - "hyper 1.4.1", + "http-body", + "hyper", "pin-project-lite", "socket2 0.5.7", "tokio", @@ -3837,16 +3809,18 @@ dependencies = [ [[package]] name = "igd-next" -version = "0.14.3" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "064d90fec10d541084e7b39ead8875a5a80d9114a2b18791565253bae25f49e4" +checksum = "76b0d7d4541def58a37bf8efc559683f21edce7c82f0d866c93ac21f7e098f93" dependencies = [ "async-trait", "attohttpc", "bytes", "futures", - "http 0.2.12", - "hyper 0.14.30", + "http 1.1.0", + "http-body-util", + "hyper", + "hyper-util", "log", "rand", "tokio", @@ -4004,9 +3978,9 @@ checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4" [[package]] name = "iroh-base" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "973c0b3c7851fa2e8e6cf4cb81c9f4cab1373848828fafa43dfe25b123a89ff2" +checksum = "28a777d7e0b3e2fdab4ad1b21b64be87a43ac3ceb2a2ccef905e480ad3317396" dependencies = [ "aead", "anyhow", @@ -4045,14 +4019,14 @@ dependencies = [ [[package]] name = "iroh-metrics" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02edfa7ca1aa89b0b9793d94671e32b79c97d61e9022f082c5eb2b95b64e90c0" +checksum = "0c78cf30022e1c7a10fc0ae0a6ba83f131b7c3b92d4876f6c97aba93fe534be6" dependencies = [ "anyhow", "erased_set", "http-body-util", - "hyper 1.4.1", + "hyper", "hyper-util", "once_cell", "prometheus-client", @@ -4066,9 +4040,9 @@ dependencies = [ [[package]] name = "iroh-net" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "329553be056a92eec7802e1c087eed951eec6e60f0f0740491ef16a295be4ca2" +checksum = "34192d8846fc59d6669fb80a485b430215ecc1bf3c2b9df4f8a92370fe37e13a" dependencies = [ "anyhow", "backoff", @@ -4090,7 +4064,7 @@ dependencies = [ "hostname", "http 1.1.0", "http-body-util", - "hyper 1.4.1", + "hyper", "hyper-util", "igd-next", "iroh-base", @@ -6242,9 +6216,9 @@ dependencies = [ "futures-core", "futures-util", "http 1.1.0", - "http-body 1.0.1", + "http-body", "http-body-util", - "hyper 1.4.1", + "hyper", "hyper-rustls", "hyper-util", "ipnet", diff --git a/Cargo.toml b/Cargo.toml index 27ed80e5e6..9f6a805e82 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,6 +29,7 @@ maybe-owned = "0.3" parking_lot = "0.12" smallvec = "1.11" ustr = "0.10" +iroh-net = "0.27" [profile.release] lto = true diff --git a/framework_crates/bones_framework/Cargo.toml b/framework_crates/bones_framework/Cargo.toml index d08fa4cba8..1ba48f2e53 100644 --- a/framework_crates/bones_framework/Cargo.toml +++ b/framework_crates/bones_framework/Cargo.toml @@ -154,9 +154,9 @@ rcgen = "0.12" rustls = { version = "0.21", features = ["dangerous_configuration", "quic"] } smallvec = "1.10" iroh-quinn = { version = "0.11" } -iroh-net = { version = "0.26", features = ["discovery-local-network"] } tokio = { version = "1", features = ["rt-multi-thread", "macros"] } turborand = { version = "0.10.0", features = ["atomic"] } +iroh-net = { workspace = true, features = ["discovery-local-network"] } directories = "5.0" diff --git a/framework_crates/bones_framework/src/networking/online.rs b/framework_crates/bones_framework/src/networking/online.rs index 79191b53ab..ce807bc2bf 100644 --- a/framework_crates/bones_framework/src/networking/online.rs +++ b/framework_crates/bones_framework/src/networking/online.rs @@ -145,7 +145,7 @@ impl MatchmakerConnectionState { if self.conn.is_none() { info!("Connecting to online matchmaker"); let ep = get_network_endpoint().await; - let conn = ep.connect(id.into(), MATCH_ALPN).await?; + let conn = ep.connect(id, MATCH_ALPN).await?; self.ep = Some(ep.clone()); self.conn = Some(conn); info!("Connected to online matchmaker"); diff --git a/other_crates/bones_matchmaker/Cargo.toml b/other_crates/bones_matchmaker/Cargo.toml index f05938bed2..fb7328dff5 100644 --- a/other_crates/bones_matchmaker/Cargo.toml +++ b/other_crates/bones_matchmaker/Cargo.toml @@ -23,6 +23,6 @@ postcard = { version = "1.0", default-features = false, features = serde = { version = "1.0", features = ["derive"] } tracing-subscriber = { version = "0.3", features = ["env-filter"] } tokio = { version = "1", features = ["rt-multi-thread", "macros"] } -iroh-net = { version = "0.26", features = ["discovery-local-network"] } +iroh-net = { workspace = true, features = ["discovery-local-network"] } quinn = { version = "0.11", package = "iroh-quinn" } blake3 = "1.5.3" diff --git a/other_crates/bones_matchmaker/src/matchmaker.rs b/other_crates/bones_matchmaker/src/matchmaker.rs index ec4e93ab66..b31dc62617 100644 --- a/other_crates/bones_matchmaker/src/matchmaker.rs +++ b/other_crates/bones_matchmaker/src/matchmaker.rs @@ -11,6 +11,7 @@ use once_cell::sync::Lazy; use quinn::Connection; use rand::{prelude::SliceRandom, SeedableRng}; use scc::HashMap as SccHashMap; +use std::cmp::Ordering; use std::collections::HashMap; use std::sync::Arc; use tokio::sync::Mutex; @@ -94,10 +95,14 @@ pub async fn start_game( } PlayerIdxAssignment::SpecifiedOrder(order) => { let mut indices = order.clone(); - if indices.len() < player_count { - indices.extend(indices.len()..player_count); - } else if indices.len() > player_count { - indices.truncate(player_count); + match indices.len().cmp(&player_count) { + Ordering::Less => { + indices.extend(indices.len()..player_count); + } + Ordering::Greater => { + indices.truncate(player_count); + } + _ => (), } indices } diff --git a/other_crates/bones_matchmaker_proto/Cargo.toml b/other_crates/bones_matchmaker_proto/Cargo.toml index 4cae9c909c..12bdaa950e 100644 --- a/other_crates/bones_matchmaker_proto/Cargo.toml +++ b/other_crates/bones_matchmaker_proto/Cargo.toml @@ -9,4 +9,4 @@ repository.workspace = true [dependencies] serde = { version = "1.0", features = ["derive"] } -iroh-net = "0.26" +iroh-net = { workspace = true }