diff --git a/firmware/runtime/src/comms.rs b/firmware/runtime/src/comms.rs index 51796ff2..1232e29a 100644 --- a/firmware/runtime/src/comms.rs +++ b/firmware/runtime/src/comms.rs @@ -107,8 +107,15 @@ async fn handle_connection(stream: &TcpStream, control: Rc {} + Ok(false) => + return Err(Error::UnexpectedPattern), + // peer has closed the connection + Err(smoltcp::Error::Illegal) => + return Ok(()), + Err(e) => + return Err(e)?, } let request: Request = FromPrimitive::from_i8(read_i8(&stream).await?) .ok_or(Error::UnrecognizedPacket)?;