From 82d5b7cdd4a5296f41fa4150f0623a9790caae8a Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Tue, 28 Mar 2023 13:55:34 +0300 Subject: [PATCH] chore(client, server, shared): update naia to 0.20.{0,1} --- Cargo.lock | 107 ++++++++++++++++++----- client/Cargo.toml | 2 +- client/src/plugins/menu/ui/connect/ui.rs | 11 ++- server/Cargo.toml | 2 +- server/src/systems/init.rs | 7 +- shared/Cargo.toml | 2 +- 6 files changed, 98 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5242f5b..3d8c82d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -663,22 +663,22 @@ dependencies = [ [[package]] name = "async-io" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c374dda1ed3e7d8f0d9ba58715f924862c63eae6849c92d3a18e7fbde9e2794" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" dependencies = [ "async-lock", "autocfg", + "cfg-if", "concurrent-queue", "futures-lite", - "libc", "log", "parking", "polling", + "rustix", "slab", "socket2", "waker-fn", - "windows-sys 0.42.0", ] [[package]] @@ -756,7 +756,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi", ] @@ -2747,6 +2747,27 @@ dependencies = [ "serde", ] +[[package]] +name = "errno" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys 0.45.0", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "error-code" version = "2.3.1" @@ -3253,6 +3274,12 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + [[package]] name = "hexasphere" version = "8.1.0" @@ -3524,6 +3551,17 @@ dependencies = [ "mach", ] +[[package]] +name = "io-lifetimes" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09270fd4fa1111bc614ed2246c7ef56239a3063d5be0d1ec3b589c505d400aeb" +dependencies = [ + "hermit-abi 0.3.1", + "libc", + "windows-sys 0.45.0", +] + [[package]] name = "ipnet" version = "2.7.0" @@ -3711,6 +3749,12 @@ dependencies = [ "cc", ] +[[package]] +name = "linux-raw-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd550e73688e6d578f0ac2119e32b797a327631a42f9433e59d02e139c8df60d" + [[package]] name = "local-channel" version = "0.1.3" @@ -3897,9 +3941,9 @@ dependencies = [ [[package]] name = "naia-bevy-client" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a95d86f7e3f9a30c4d439fee5dd628819c1602ec790a5bf88646f03d6a5ac2e5" +checksum = "418968b6b53a544efd811b9b12acd014b17e8a1395f3a67836cb23ffa4c5a4d1" dependencies = [ "bevy_app", "bevy_ecs", @@ -3909,9 +3953,9 @@ dependencies = [ [[package]] name = "naia-bevy-server" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed249937198f7d0b14b3261dc488cfbf59df9d916e1724b645c9834e844e5722" +checksum = "f1a8e4ceddb7bc7e56007f2dcbd6a1628b9510e2950eedf21100b06625f49f0e" dependencies = [ "bevy_app", "bevy_ecs", @@ -3921,9 +3965,9 @@ dependencies = [ [[package]] name = "naia-bevy-shared" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82af7c36942c0ea3d5b9e8055c69ddd68121727fc56a93acc3e3f6619260d576" +checksum = "dfda44d39dd0b63d1d10917387705e300a0a5409c6b82bd8e805c48f33a34cfb" dependencies = [ "bevy_app", "bevy_ecs", @@ -3932,9 +3976,9 @@ dependencies = [ [[package]] name = "naia-client" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fdbd923182ee2ebc315bd48bec12731e98f0a1f8eaeca0d82e74996eed713b" +checksum = "d1ba288827aec565275378c78746a9c7609077a0c2f36955ba21a3f54444a61e" dependencies = [ "bevy_ecs", "cfg-if", @@ -3945,9 +3989,9 @@ dependencies = [ [[package]] name = "naia-client-socket" -version = "0.15.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b4fb4a8ddab24e2770412fc6cd9263a9ac40139cc66db8b3455953838efcede" +checksum = "a2e582cd071b36854bc6eb7be347259390eae09d1d4e62f1d3b59c307edc0de8" dependencies = [ "cfg-if", "js-sys", @@ -4000,11 +4044,12 @@ dependencies = [ [[package]] name = "naia-server" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c86255d921676bdce86400030316ade856324929014cde791e11f77fd6e904b" +checksum = "a3861c85efafdea75af119ce8f927a9218c579f2142596ec9b202b5f832dd0bb" dependencies = [ "bevy_ecs", + "cfg-if", "fastrand", "log", "naia-server-socket", @@ -4014,9 +4059,9 @@ dependencies = [ [[package]] name = "naia-server-socket" -version = "0.15.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5deb7a08d297ffd5c35c31024165e0c36789638173829bedad457cccf4ed9a2" +checksum = "2f169830be8915c1baac5ca2579a27d654809ba195811a07c528338f2b2e1b5a" dependencies = [ "async-dup", "futures-channel", @@ -4032,9 +4077,9 @@ dependencies = [ [[package]] name = "naia-shared" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee3baf481b0aeb888278c4e0f28ea4fb9d505bc1a7b2e0d3f4f2e95c9b8770ee" +checksum = "12c83f13ed07552b3f9b4fa1f2e30235611f8c1cc5bafbf5b0e02ff95da2dea4" dependencies = [ "bevy_ecs", "cfg-if", @@ -4047,9 +4092,9 @@ dependencies = [ [[package]] name = "naia-socket-shared" -version = "0.15.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8000dd80103391049677f0b33ddd48b7a9dcfb13118f183ae9ad26306f215d" +checksum = "7ba45e4f2b3d5aa7811e906811f298d234e02f9a2918edee4885b4b9b4030f3c" dependencies = [ "cfg-if", "js-sys", @@ -4277,7 +4322,7 @@ version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", ] @@ -5142,6 +5187,20 @@ dependencies = [ "nom 7.1.1", ] +[[package]] +name = "rustix" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b24138615de35e32031d041a09032ef3487a616d901ca4db224e7d557efae2" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.45.0", +] + [[package]] name = "rustls" version = "0.19.1" diff --git a/client/Cargo.toml b/client/Cargo.toml index 5ce7ec8..f3735d1 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -23,7 +23,7 @@ dev = [ [dependencies] laurelin_shared = { package = "shared", path = "../shared" } -naia-bevy-client = "0.19.0" +naia-bevy-client = { version = "0.20.1", features = [ "transport_webrtc" ] } # one dep needs ^0.5.9, and another one needs ^0.5.10 # and for some reason cargo can't figure this out, so we're forcing it for now. diff --git a/client/src/plugins/menu/ui/connect/ui.rs b/client/src/plugins/menu/ui/connect/ui.rs index c38222b..75d7b6f 100644 --- a/client/src/plugins/menu/ui/connect/ui.rs +++ b/client/src/plugins/menu/ui/connect/ui.rs @@ -9,7 +9,7 @@ use bevy::ecs::system::{Res, ResMut}; use bevy_egui::{egui, EguiContexts}; use laurelin_shared::server::messages::Auth; -use naia_bevy_client::Client; +use naia_bevy_client::{transport::webrtc, Client}; use crate::{ cfg::CfgDev, @@ -49,7 +49,7 @@ pub fn ui( data.state = ConnectState::LoggingIn; client.auth(Auth::new(None, &data.email, &data.password)); - client.connect(&cfg_dev.server_address) + connect(&mut client, &cfg_dev); } }); @@ -94,7 +94,7 @@ pub fn ui( &data.email, &data.password, )); - client.connect(&cfg_dev.server_address) + connect(&mut client, &cfg_dev); } }); }); @@ -113,3 +113,8 @@ pub fn ui( }, ); } + +fn connect(client: &mut Client, cfg_dev: &CfgDev) { + let socket = webrtc::Socket::new(&cfg_dev.server_address, client.socket_config()); + client.connect(socket); +} diff --git a/server/Cargo.toml b/server/Cargo.toml index 8609172..972464a 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -12,7 +12,7 @@ publish = false [dependencies] laurelin_shared = { package = "shared", path = "../shared" } -naia-bevy-server = "0.19.0" +naia-bevy-server = { version = "0.20.0", features = [ "transport_webrtc" ] } bevy_app = { version = "0.10.0", default-features=false } bevy_core = { version = "0.10.0", default-features=false } diff --git a/server/src/systems/init.rs b/server/src/systems/init.rs index 9ab3dbb..3013ad6 100644 --- a/server/src/systems/init.rs +++ b/server/src/systems/init.rs @@ -7,12 +7,12 @@ */ use bevy_log::info; -use naia_bevy_server::{Server, ServerAddrs}; +use naia_bevy_server::{transport::webrtc, Server}; pub(crate) fn init(mut server: Server) { info!("Laurelin server listening"); - let server_addrs = ServerAddrs::new( + let server_addrs = webrtc::ServerAddrs::new( "0.0.0.0:14191" .parse() .expect("could not parse Signaling address/port"), @@ -22,5 +22,6 @@ pub(crate) fn init(mut server: Server) { "http://127.0.0.1:14192", ); - server.listen(&server_addrs); + let socket = webrtc::Socket::new(&server_addrs, server.socket_config()); + server.listen(socket); } diff --git a/shared/Cargo.toml b/shared/Cargo.toml index dfe8ce1..9947d51 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -12,7 +12,7 @@ publish = false [dependencies] laurelin_schema = { package = "schema", path = "../schema" } -naia-bevy-shared = "0.19.0" +naia-bevy-shared = "0.20.0" thiserror = "1.0.38" -- 2.44.1