From c566769c516c1a2824339e67bbd96361fa7f4d38 Mon Sep 17 00:00:00 2001 From: Santiago Carmuega Date: Sun, 2 Jan 2022 10:29:46 -0300 Subject: [PATCH] fix(machines): Don't warn on expected end-of-input errors (#15) --- pallas-machines/src/payloads.rs | 7 +++---- pallas-multiplexer/src/lib.rs | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pallas-machines/src/payloads.rs b/pallas-machines/src/payloads.rs index fd12577..ed27ab3 100644 --- a/pallas-machines/src/payloads.rs +++ b/pallas-machines/src/payloads.rs @@ -1,6 +1,6 @@ use super::*; -use log::{debug, warn}; +use log::debug; use minicbor::{Decoder, Encoder}; use pallas_multiplexer::Payload; use std::{ @@ -142,9 +142,8 @@ impl<'a> PayloadDeconstructor<'a> { debug!("consumed {} from payload buffer", new_pos); Ok(t) } - Err(err) => { - //TODO: we need to filter this only for correct errors - warn!("{:?}", err); + Err(_err) => { + //TODO: we need to match EndOfInput kind of errors debug!("payload incomplete, fetching next segment"); let payload = self.rx.recv()?; diff --git a/pallas-multiplexer/src/lib.rs b/pallas-multiplexer/src/lib.rs index 9a104d6..1cb176e 100644 --- a/pallas-multiplexer/src/lib.rs +++ b/pallas-multiplexer/src/lib.rs @@ -8,7 +8,7 @@ use std::{ time::{Duration, Instant}, }; -use log::{debug, error, trace, warn}; +use log::{debug, error, warn}; pub trait Bearer: Read + Write + Send + Sync + Sized { fn read_segment(&mut self) -> Result<(u16, u32, Payload), std::io::Error>; @@ -49,7 +49,7 @@ where } Err(TryRecvError::Disconnected) => { //TODO: remove handle from list - trace!("protocol handle {} disconnected", id); + warn!("protocol handle {} disconnected", id); } Err(TryRecvError::Empty) => (), };