From 4991dbb20fab2d851ec0c37423ef020a806b5f7f Mon Sep 17 00:00:00 2001 From: trivernis Date: Thu, 10 Sep 2020 17:52:27 +0200 Subject: [PATCH] Add more logging Signed-off-by: trivernis --- src/server.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/server.rs b/src/server.rs index fed37c5..9ed1b87 100644 --- a/src/server.rs +++ b/src/server.rs @@ -47,6 +47,7 @@ impl RpcServer { pub fn start(&mut self) -> io::Result<()> { let listener = TcpListener::bind(&self.address)?; for stream in listener.incoming() { + log::trace!("Connection received."); match stream { Ok(s) => if let Err(e) = self.handle_message(s) { log::trace!("Error handling message {}", e.to_string()) @@ -71,8 +72,12 @@ impl RpcServer { incoming.read(&mut buf)?; data.append(&mut buf.to_vec()) } + log::trace!("Message read as {:?}", data); - let message = Message::from_bytes(&data).map_err(|_|io::Error::from(ErrorKind::InvalidData))?; + let message = Message::from_bytes(&data).map_err(|e|{ + log::trace!("Failed to deserialize: {:?}", e); + io::Error::from(ErrorKind::InvalidData) + })?; let wg = WaitGroup::new(); let handler = Arc::new(Mutex::new(MessageHandler {