Add more logging

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/1/head
trivernis 4 years ago
parent c84d69c164
commit 4991dbb20f
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -47,6 +47,7 @@ impl RpcServer {
pub fn start(&mut self) -> io::Result<()> { pub fn start(&mut self) -> io::Result<()> {
let listener = TcpListener::bind(&self.address)?; let listener = TcpListener::bind(&self.address)?;
for stream in listener.incoming() { for stream in listener.incoming() {
log::trace!("Connection received.");
match stream { match stream {
Ok(s) => if let Err(e) = self.handle_message(s) { Ok(s) => if let Err(e) = self.handle_message(s) {
log::trace!("Error handling message {}", e.to_string()) log::trace!("Error handling message {}", e.to_string())
@ -71,8 +72,12 @@ impl RpcServer {
incoming.read(&mut buf)?; incoming.read(&mut buf)?;
data.append(&mut buf.to_vec()) 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 wg = WaitGroup::new();
let handler = Arc::new(Mutex::new(MessageHandler { let handler = Arc::new(Mutex::new(MessageHandler {

Loading…
Cancel
Save