mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-21 14:28:43 -06:00
fix 2??
This commit is contained in:
parent
80c3f354f1
commit
7bcfc75dfe
|
@ -42,8 +42,7 @@ pub fn send_chunk_compressed(
|
||||||
message: &ServerToClientMessage
|
message: &ServerToClientMessage
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let mut ser_message = postcard::to_allocvec(&message)?;
|
let mut ser_message = postcard::to_allocvec(&message)?;
|
||||||
let (_, data) = ser_message.split_at_mut(1);
|
let mut compressed = lz4_compress(&ser_message[1..]);
|
||||||
let mut compressed = lz4_compress(&data);
|
|
||||||
ser_message.truncate(1);
|
ser_message.truncate(1);
|
||||||
ser_message.append(&mut compressed);
|
ser_message.append(&mut compressed);
|
||||||
let ser_message = ser_message.into_boxed_slice();
|
let ser_message = ser_message.into_boxed_slice();
|
||||||
|
|
|
@ -113,7 +113,7 @@ 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 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")?;
|
let deserialized = postcard::from_bytes(&decompressed).ok().context("Deserialization failed")?;
|
||||||
Ok(deserialized)
|
Ok(deserialized)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue