From 21d98711c1570cee9b9fa2deb875882123c262a0 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 29 May 2021 17:13:22 +0800 Subject: [PATCH] use new smoltcp error code --- src/runtime/src/comms.rs | 4 ++-- src/runtime/src/mgmt.rs | 2 +- src/runtime/src/moninj.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/runtime/src/comms.rs b/src/runtime/src/comms.rs index da9d8ac..06ff331 100644 --- a/src/runtime/src/comms.rs +++ b/src/runtime/src/comms.rs @@ -94,13 +94,13 @@ async fn read_request(stream: &TcpStream, allow_close: bool) -> Result {} Ok(false) => return Err(Error::UnexpectedPattern), - Err(smoltcp::Error::Illegal) => { + Err(smoltcp::Error::Finished) => { if allow_close { info!("peer closed connection"); return Ok(None); } else { error!("peer unexpectedly closed connection"); - return Err(smoltcp::Error::Illegal)?; + return Err(smoltcp::Error::Finished)?; } }, Err(e) => diff --git a/src/runtime/src/mgmt.rs b/src/runtime/src/mgmt.rs index 10a4395..06ed8d5 100644 --- a/src/runtime/src/mgmt.rs +++ b/src/runtime/src/mgmt.rs @@ -121,7 +121,7 @@ async fn handle_connection( loop { let msg = read_i8(stream).await; - if let Err(smoltcp::Error::Illegal) = msg { + if let Err(smoltcp::Error::Finished) = msg { return Ok(()); } let msg: Request = FromPrimitive::from_i8(msg?).ok_or(Error::UnrecognizedPacket)?; diff --git a/src/runtime/src/moninj.rs b/src/runtime/src/moninj.rs index ac12a88..d1124b4 100644 --- a/src/runtime/src/moninj.rs +++ b/src/runtime/src/moninj.rs @@ -184,7 +184,7 @@ pub fn start(timer: GlobalTimer) { info!("received connection"); let result = handle_connection(&stream, timer).await; match result { - Err(Error::NetworkError(smoltcp::Error::Illegal)) => info!("peer closed connection"), + Err(Error::NetworkError(smoltcp::Error::Finished)) => info!("peer closed connection"), Err(error) => warn!("connection terminated: {}", error), _ => (), }