1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-06-30 11:47:45 +00:00

Stop panicking when receiving None segments from the client

This apparently happens when you send chat messages super quick, and
they seem harmless to ignore.

Fixes #40
This commit is contained in:
Joshua Goins 2025-06-21 14:04:09 -04:00
parent 0d37dd7b6e
commit bdd98820e7

View file

@ -150,6 +150,7 @@ async fn client_loop(
let (segments, connection_type) = connection.parse_packet(&buf[..n]).await; let (segments, connection_type) = connection.parse_packet(&buf[..n]).await;
for segment in &segments { for segment in &segments {
match &segment.data { match &segment.data {
SegmentData::None() => {},
SegmentData::Setup { ticket } => { SegmentData::Setup { ticket } => {
// for some reason they send a string representation // for some reason they send a string representation
let actor_id = ticket.parse::<u32>().unwrap(); let actor_id = ticket.parse::<u32>().unwrap();
@ -807,7 +808,7 @@ async fn client_loop(
} }
SegmentData::KawariIpc { data } => handle_custom_ipc(&mut connection, data).await, SegmentData::KawariIpc { data } => handle_custom_ipc(&mut connection, data).await,
_ => { _ => {
panic!("The server is recieving a response or unknown packet!") panic!("The server is recieving a response or unknown packet: {segment:#?}")
} }
} }
} }