fix crash when receiving HardReset

This commit is contained in:
Vinzenz Schroeter 2025-01-28 21:36:16 +01:00
parent 0aa66e3ebd
commit 6b4ba5ac44

View file

@ -45,7 +45,22 @@ impl<'t> UdpServer<'t> {
if let Some(cmd) = self.receive_into_buf().and_then(|amount| {
Self::command_from_slice(&self.buf[..amount])
}) {
self.handle_command(cmd);
match self.command_executor.execute(cmd) {
ExecutionResult::Success => {
self.app_events
.send_event(AppEvents::UdpPacketHandled)
.expect("could not send packet handled event");
}
ExecutionResult::Failure => {
error!("failed to execute command");
}
ExecutionResult::Shutdown => {
self.app_events
.send_event(AppEvents::UdpThreadClosed)
.expect("could not send close event");
break;
}
}
}
}
}
@ -81,22 +96,4 @@ impl<'t> UdpServer<'t> {
}
Some(amount)
}
fn handle_command(&mut self, command: Command) {
match self.command_executor.execute(command) {
ExecutionResult::Success => {
self.app_events
.send_event(AppEvents::UdpPacketHandled)
.expect("could not send packet handled event");
}
ExecutionResult::Failure => {
error!("failed to execute command");
}
ExecutionResult::Shutdown => {
self.app_events
.send_event(AppEvents::UdpThreadClosed)
.expect("could not send close event");
}
}
}
}