From 8c609472917d83b859bb3951a7a05a69b2c34ab4 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 20 Jul 2020 19:07:44 +0800 Subject: [PATCH] moninj: better connection logging --- src/runtime/src/moninj.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/runtime/src/moninj.rs b/src/runtime/src/moninj.rs index 41b5c45b..6da9fbe9 100644 --- a/src/runtime/src/moninj.rs +++ b/src/runtime/src/moninj.rs @@ -1,6 +1,6 @@ use core::fmt; use alloc::collections::BTreeMap; -use log::{debug, warn}; +use log::{debug, info, warn}; use void::Void; use libboard_zynq::{smoltcp, timer::GlobalTimer, time::Milliseconds}; @@ -180,9 +180,13 @@ pub fn start(timer: GlobalTimer) { loop { let stream = TcpStream::accept(1383, 2048, 2048).await.unwrap(); task::spawn(async move { - let _ = handle_connection(&stream, timer) - .await - .map_err(|e| warn!("connection terminated: {}", e)); + info!("received connection"); + let result = handle_connection(&stream, timer).await; + match result { + Err(Error::NetworkError(smoltcp::Error::Illegal)) => info!("peer closed connection"), + Err(error) => warn!("connection terminated: {}", error), + _ => (), + } let _ = stream.flush().await; let _ = stream.abort().await; });