mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-25 08:18:43 -06:00
asss
This commit is contained in:
parent
7bcfc75dfe
commit
68bc848cbd
|
@ -20,7 +20,7 @@ flume = "0.10"
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
uflow = "0.7"
|
uflow = "0.7"
|
||||||
postcard = { version = "1.0", features = ["alloc"] }
|
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]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
|
|
@ -22,7 +22,7 @@ gilrs = { version = "0.10", default_features = false, features = ["xinput"] }
|
||||||
uflow = "0.7"
|
uflow = "0.7"
|
||||||
postcard = { version = "1.0", features = ["alloc"] }
|
postcard = { version = "1.0", features = ["alloc"] }
|
||||||
serde_json = { version = "1.0", optional = true }
|
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]
|
[target.'cfg(target_os = "windows")'.dependencies]
|
||||||
winapi = { version = "0.3" }
|
winapi = { version = "0.3" }
|
||||||
|
|
|
@ -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).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")?;
|
let deserialized = postcard::from_bytes(&decompressed).ok().context("Deserialization failed")?;
|
||||||
Ok(deserialized)
|
Ok(deserialized)
|
||||||
}
|
}
|
||||||
|
@ -126,9 +126,10 @@ fn inject_network_responses_into_manager_queue(
|
||||||
for event in events.iter() {
|
for event in events.iter() {
|
||||||
if event.is_message_of_type::<S_CHUNK_RESPONSE>() {
|
if event.is_message_of_type::<S_CHUNK_RESPONSE>() {
|
||||||
let NetworkEvent(ClientEvent::Receive(data)) = &event else { unreachable!() };
|
let NetworkEvent(ClientEvent::Receive(data)) = &event else { unreachable!() };
|
||||||
|
let packet = decompress_chunk_packet(data).expect("Chunk decode failed");
|
||||||
let ServerToClientMessage::ChunkResponse {
|
let ServerToClientMessage::ChunkResponse {
|
||||||
chunk, data, queued
|
chunk, data, queued
|
||||||
} = decompress_chunk_packet(data).expect("Chunk decode failed") else { unreachable!() };
|
} = packet else { unreachable!() };
|
||||||
manager.add_sussy_response(ChunkTaskResponse::LoadedChunk {
|
manager.add_sussy_response(ChunkTaskResponse::LoadedChunk {
|
||||||
position: chunk,
|
position: chunk,
|
||||||
chunk_data: data,
|
chunk_data: data,
|
||||||
|
|
Loading…
Reference in a new issue