Hide unknown messages in production (#275)

This commit is contained in:
Maciej Hirsz
2020-08-04 13:04:46 +02:00
committed by GitHub
parent 9e08387dd1
commit 525f95b92a
+3
View File
@@ -154,10 +154,13 @@ impl StreamHandler<ws::Message, ws::ProtocolError> for NodeConnector {
// info!("New node message: {}", std::str::from_utf8(&data).unwrap_or_else(|_| "INVALID UTF8"));
self.handle_message(msg, data, ctx)
},
#[cfg(debug)]
Err(err) => {
let data: &[u8] = data.get(..512).unwrap_or_else(|| &data);
warn!("Failed to parse node message: {} {}", err, std::str::from_utf8(data).unwrap_or_else(|_| "INVALID UTF8"))
},
#[cfg(not(debug))]
Err(_) => (),
}
}
}