From 321e69f9760abb152eb536e1007066e356631b46 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Thu, 9 Mar 2023 04:21:59 +0100 Subject: [PATCH] fix 2?? --- kubi-server/src/world.rs | 3 +-- kubi/src/networking.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/kubi-server/src/world.rs b/kubi-server/src/world.rs index faad774..de7e522 100644 --- a/kubi-server/src/world.rs +++ b/kubi-server/src/world.rs @@ -42,8 +42,7 @@ pub fn send_chunk_compressed( message: &ServerToClientMessage ) -> Result<()> { let mut ser_message = postcard::to_allocvec(&message)?; - let (_, data) = ser_message.split_at_mut(1); - let mut compressed = lz4_compress(&data); + let mut compressed = lz4_compress(&ser_message[1..]); ser_message.truncate(1); ser_message.append(&mut compressed); let ser_message = ser_message.into_boxed_slice(); diff --git a/kubi/src/networking.rs b/kubi/src/networking.rs index 5541bd0..7fe7d48 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).ok().context("Decompress failed")?; + let decompressed = decompress_size_prepended(data_ref).map_err(|x| println!("{x}")).ok().context("Decompress failed")?; let deserialized = postcard::from_bytes(&decompressed).ok().context("Deserialization failed")?; Ok(deserialized) }