From 1bee59651f77b8dd5adbeefd9d402f488ae0e55f Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 24 Jun 2022 01:06:04 -0500 Subject: [PATCH 1/3] Optimize flate2 --- Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 484da0b2..9718244e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,3 +26,5 @@ opt-level = 3 opt-level = 3 [profile.dev.package.aes] opt-level = 3 +[profile.dev.package.flate2] +opt-level = 3 From 3fcbfc794e433c5b8cd6b36d094ce1b78d997ba6 Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 24 Jun 2022 03:50:19 -0500 Subject: [PATCH 2/3] Upgrade crates and remove num_* deps --- Cargo.lock | 7 ++----- azalea-auth/Cargo.toml | 2 +- azalea-client/Cargo.toml | 2 +- azalea-core/Cargo.toml | 2 +- azalea-language/Cargo.toml | 2 +- azalea-protocol/Cargo.toml | 7 ++----- azalea-protocol/src/packets/mod.rs | 16 +++++++++++++--- bot/Cargo.toml | 2 +- 8 files changed, 22 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f3b5df08..a73b340f 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -167,12 +167,9 @@ dependencies = [ "byteorder", "bytes", "flate2", - "num-derive", - "num-traits", "packet-macros", "serde", "serde_json", - "thiserror", "tokio", "tokio-util", "trust-dns-resolver", @@ -1420,9 +1417,9 @@ dependencies = [ [[package]] name = "uuid" -version = "0.8.2" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f" [[package]] name = "version_check" diff --git a/azalea-auth/Cargo.toml b/azalea-auth/Cargo.toml index aa9b7bdb..a7a11b53 100755 --- a/azalea-auth/Cargo.toml +++ b/azalea-auth/Cargo.toml @@ -6,4 +6,4 @@ version = "0.1.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -uuid = "^0.8.2" +uuid = "^1.1.2" diff --git a/azalea-client/Cargo.toml b/azalea-client/Cargo.toml index 1156f8de..eaf7b0dc 100755 --- a/azalea-client/Cargo.toml +++ b/azalea-client/Cargo.toml @@ -11,4 +11,4 @@ azalea-core = {path = "../azalea-core"} azalea-crypto = {path = "../azalea-crypto"} azalea-protocol = {path = "../azalea-protocol"} azalea-world = {path = "../azalea-world"} -tokio = {version = "1.18.0", features = ["sync"]} +tokio = {version = "1.19.2", features = ["sync"]} diff --git a/azalea-core/Cargo.toml b/azalea-core/Cargo.toml index d652a46e..27112b21 100755 --- a/azalea-core/Cargo.toml +++ b/azalea-core/Cargo.toml @@ -8,4 +8,4 @@ version = "0.1.0" [dependencies] azalea-chat = {path = "../azalea-chat"} azalea-nbt = {path = "../azalea-nbt"} -uuid = "^0.8.2" +uuid = "^1.1.2" diff --git a/azalea-language/Cargo.toml b/azalea-language/Cargo.toml index 0e093008..dea9aa27 100644 --- a/azalea-language/Cargo.toml +++ b/azalea-language/Cargo.toml @@ -9,4 +9,4 @@ version = "0.1.0" lazy_static = "1.4.0" serde = "1.0.137" serde_json = "1.0.81" -# tokio = {version = "1.18.2", features = ["fs"]} +# tokio = {version = "1.19.2", features = ["fs"]} diff --git a/azalea-protocol/Cargo.toml b/azalea-protocol/Cargo.toml index 899b44a8..d98705bd 100755 --- a/azalea-protocol/Cargo.toml +++ b/azalea-protocol/Cargo.toml @@ -17,13 +17,10 @@ azalea-nbt = {path = "../azalea-nbt"} byteorder = "^1.4.3" bytes = "^1.1.0" flate2 = "1.0.23" -num-derive = "^0.3.3" -num-traits = "^0.2.14" packet-macros = {path = "./packet-macros"} serde = {version = "1.0.130", features = ["serde_derive"]} serde_json = "^1.0.72" -thiserror = "^1.0.30" -tokio = {version = "^1.14.0", features = ["io-util", "net", "macros"]} +tokio = {version = "1.19.2", features = ["io-util", "net", "macros"]} tokio-util = "^0.6.9" trust-dns-resolver = "^0.20.3" -uuid = "^0.8.2" +uuid = "^1.1.2" diff --git a/azalea-protocol/src/packets/mod.rs b/azalea-protocol/src/packets/mod.rs index 1cc79b79..73a3a842 100755 --- a/azalea-protocol/src/packets/mod.rs +++ b/azalea-protocol/src/packets/mod.rs @@ -9,12 +9,10 @@ use crate::{ connect::PacketFlow, mc_buf::{McBufReadable, McBufWritable, Readable, Writable}, }; -use num_derive::FromPrimitive; -use num_traits::FromPrimitive; pub const PROTOCOL_VERSION: u32 = 759; -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, FromPrimitive)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum ConnectionProtocol { Handshake = -1, Game = 0, @@ -22,6 +20,18 @@ pub enum ConnectionProtocol { Login = 2, } +impl ConnectionProtocol { + pub fn from_i32(i: i32) -> Option { + match i { + -1 => Some(ConnectionProtocol::Handshake), + 0 => Some(ConnectionProtocol::Game), + 1 => Some(ConnectionProtocol::Status), + 2 => Some(ConnectionProtocol::Login), + _ => None, + } + } +} + #[derive(Clone, Debug)] pub enum Packet { Game(game::GamePacket), diff --git a/bot/Cargo.toml b/bot/Cargo.toml index e55f6c3d..1a6a44a3 100755 --- a/bot/Cargo.toml +++ b/bot/Cargo.toml @@ -9,4 +9,4 @@ version = "0.1.0" azalea-client = {path = "../azalea-client"} azalea-core = {path = "../azalea-core"} azalea-protocol = {path = "../azalea-protocol"} -tokio = "^1.14.0" +tokio = "1.19.2" From 69c47eda4c496b13dadd80976bffd2fab7ea5894 Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 24 Jun 2022 04:08:38 -0500 Subject: [PATCH 3/3] Upgrade some crates --- Cargo.lock | 85 ++++++++++---------------------------- azalea-protocol/Cargo.toml | 5 +-- 2 files changed, 23 insertions(+), 67 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a73b340f..9e4f14f5 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -34,9 +34,9 @@ dependencies = [ [[package]] name = "async-recursion" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7d78656ba01f1b93024b7c3a0467f1608e4be67d725749fdcd7d2c7678fd7a2" +checksum = "2cda8f4bcc10624c4e85bc66b3f452cca98cfa5ca002dc83a16aad2367641bea" dependencies = [ "proc-macro2", "quote", @@ -171,7 +171,6 @@ dependencies = [ "serde", "serde_json", "tokio", - "tokio-util", "trust-dns-resolver", "uuid", ] @@ -460,9 +459,9 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "enum-as-inner" -version = "0.3.4" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "570d109b813e904becc80d8d5da38376818a143348413f7149f1340fe04754d4" +checksum = "21cdad81446a7f7dc43f6a77409efeb9733d2fa65553efef6018ef257c959b73" dependencies = [ "heck", "proc-macro2", @@ -511,12 +510,6 @@ version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" -[[package]] -name = "futures-sink" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" - [[package]] name = "futures-task" version = "0.3.21" @@ -609,22 +602,13 @@ dependencies = [ "generic-array", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - [[package]] name = "ipconfig" -version = "0.2.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7e2f18aece9709094573a9f24f483c4f65caa4298e2f7ae1b71cc65d853fad7" +checksum = "723519edce41262b05d4143ceb95050e4c614f483e78e9fd9e39a8275a84ad98" dependencies = [ - "socket2 0.3.19", + "socket2", "widestring", "winapi", "winreg", @@ -880,27 +864,25 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ - "instant", "lock_api", "parking_lot_core", ] [[package]] name = "parking_lot_core" -version = "0.8.5" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" dependencies = [ "cfg-if", - "instant", "libc", "redox_syscall", "smallvec", - "winapi", + "windows-sys", ] [[package]] @@ -1196,17 +1178,6 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" -[[package]] -name = "socket2" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" -dependencies = [ - "cfg-if", - "libc", - "winapi", -] - [[package]] name = "socket2" version = "0.4.4" @@ -1295,7 +1266,7 @@ dependencies = [ "num_cpus", "once_cell", "pin-project-lite", - "socket2 0.4.4", + "socket2", "tokio-macros", "winapi", ] @@ -1311,25 +1282,11 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-util" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project-lite", - "tokio", -] - [[package]] name = "trust-dns-proto" -version = "0.20.4" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca94d4e9feb6a181c690c4040d7a24ef34018d8313ac5044a61d21222ae24e31" +checksum = "9c31f240f59877c3d4bb3b3ea0ec5a6a0cff07323580ff8c7a605cd7d08b255d" dependencies = [ "async-trait", "cfg-if", @@ -1352,9 +1309,9 @@ dependencies = [ [[package]] name = "trust-dns-resolver" -version = "0.20.4" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecae383baad9995efaa34ce8e57d12c3f305e545887472a492b838f4b5cfb77a" +checksum = "e4ba72c2ea84515690c9fcef4c6c660bb9df3036ed1051686de84605b74fd558" dependencies = [ "cfg-if", "futures-util", @@ -1516,9 +1473,9 @@ dependencies = [ [[package]] name = "widestring" -version = "0.4.3" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c" +checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983" [[package]] name = "winapi" @@ -1596,9 +1553,9 @@ checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" [[package]] name = "winreg" -version = "0.6.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" +checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" dependencies = [ "winapi", ] diff --git a/azalea-protocol/Cargo.toml b/azalea-protocol/Cargo.toml index d98705bd..e49088bc 100755 --- a/azalea-protocol/Cargo.toml +++ b/azalea-protocol/Cargo.toml @@ -7,7 +7,7 @@ version = "0.1.0" [dependencies] async-compression = {version = "^0.3.8", features = ["tokio", "zlib"]} -async-recursion = "^0.3.2" +async-recursion = "^1.0.0" azalea-auth = {path = "../azalea-auth"} azalea-brigadier = {path = "../azalea-brigadier"} azalea-chat = {path = "../azalea-chat"} @@ -21,6 +21,5 @@ packet-macros = {path = "./packet-macros"} serde = {version = "1.0.130", features = ["serde_derive"]} serde_json = "^1.0.72" tokio = {version = "1.19.2", features = ["io-util", "net", "macros"]} -tokio-util = "^0.6.9" -trust-dns-resolver = "^0.20.3" +trust-dns-resolver = {version = "^0.21.2"} uuid = "^1.1.2"