fix client decompression

This commit is contained in:
griffi-gh 2023-03-09 17:56:30 +01:00
parent 9cf4e81818
commit 940a43330a

View file

@ -112,8 +112,8 @@ fn check_server_hello_response(
//TODO multithreaded decompression //TODO multithreaded decompression
fn decompress_chunk_packet(data: &Box<[u8]>) -> Result<ServerToClientMessage> { fn decompress_chunk_packet(data: &Box<[u8]>) -> Result<ServerToClientMessage> {
let data_ref = &data[1..]; let mut decompressed = decompress_size_prepended(&data[1..])?;
let decompressed = decompress_size_prepended(data_ref)?; decompressed.insert(0, data[0]);
let deserialized = postcard::from_bytes(&decompressed).ok().context("Deserialization failed")?; let deserialized = postcard::from_bytes(&decompressed).ok().context("Deserialization failed")?;
Ok(deserialized) Ok(deserialized)
} }