From 9cf4e81818da801294f81c86bb3a8afd3c39502f Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Thu, 9 Mar 2023 04:29:21 +0100 Subject: [PATCH] asss --- kubi-server/Cargo.toml | 2 +- kubi/Cargo.toml | 2 +- kubi/src/networking.rs | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/kubi-server/Cargo.toml b/kubi-server/Cargo.toml index d903b93..1412cc0 100644 --- a/kubi-server/Cargo.toml +++ b/kubi-server/Cargo.toml @@ -20,7 +20,7 @@ flume = "0.10" rand = "0.8" uflow = "0.7" postcard = { version = "1.0", features = ["alloc"] } -lz4_flex = { version = "0.10", default-features = false, features = ["checked-decode"] } +lz4_flex = { version = "0.10", default-features = false, features = ["checked-decode", "std"] } [features] default = [] diff --git a/kubi/Cargo.toml b/kubi/Cargo.toml index 8f2eb1d..0cdb101 100644 --- a/kubi/Cargo.toml +++ b/kubi/Cargo.toml @@ -22,7 +22,7 @@ gilrs = { version = "0.10", default_features = false, features = ["xinput"] } uflow = "0.7" postcard = { version = "1.0", features = ["alloc"] } serde_json = { version = "1.0", optional = true } -lz4_flex = { version = "0.10", default-features = false, features = ["checked-decode"] } +lz4_flex = { version = "0.10", default-features = false, features = ["checked-decode", "std"] } [target.'cfg(target_os = "windows")'.dependencies] winapi = { version = "0.3" } diff --git a/kubi/src/networking.rs b/kubi/src/networking.rs index 7fe7d48..61d3eac 100644 --- a/kubi/src/networking.rs +++ b/kubi/src/networking.rs @@ -113,7 +113,7 @@ fn check_server_hello_response( //TODO multithreaded decompression fn decompress_chunk_packet(data: &Box<[u8]>) -> Result { let data_ref = &data[1..]; - let decompressed = decompress_size_prepended(data_ref).map_err(|x| println!("{x}")).ok().context("Decompress failed")?; + let decompressed = decompress_size_prepended(data_ref)?; let deserialized = postcard::from_bytes(&decompressed).ok().context("Deserialization failed")?; Ok(deserialized) } @@ -126,9 +126,10 @@ fn inject_network_responses_into_manager_queue( for event in events.iter() { if event.is_message_of_type::() { let NetworkEvent(ClientEvent::Receive(data)) = &event else { unreachable!() }; + let packet = decompress_chunk_packet(data).expect("Chunk decode failed"); let ServerToClientMessage::ChunkResponse { chunk, data, queued - } = decompress_chunk_packet(data).expect("Chunk decode failed") else { unreachable!() }; + } = packet else { unreachable!() }; manager.add_sussy_response(ChunkTaskResponse::LoadedChunk { position: chunk, chunk_data: data,