From 010266e001608b57cbb3bd58e39f42f251f7e3f4 Mon Sep 17 00:00:00 2001 From: Alexey Galakhov Date: Mon, 13 Jan 2020 22:22:42 +0100 Subject: [PATCH] test: autobahn: add strict error reporting Signed-off-by: Alexey Galakhov --- examples/autobahn-client.rs | 6 ++---- examples/autobahn-server.rs | 11 +++++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/examples/autobahn-client.rs b/examples/autobahn-client.rs index 0962d9d..31aedb2 100644 --- a/examples/autobahn-client.rs +++ b/examples/autobahn-client.rs @@ -50,10 +50,8 @@ fn main() { for case in 1..=total { if let Err(e) = run_test(case) { match e { - Error::Protocol(_) => {} - err => { - warn!("test: {}", err); - } + Error::ConnectionClosed | Error::Protocol(_) | Error::Utf8 => (), + err => error!("test: {}", err), } } } diff --git a/examples/autobahn-server.rs b/examples/autobahn-server.rs index 31b842c..3c99545 100644 --- a/examples/autobahn-server.rs +++ b/examples/autobahn-server.rs @@ -14,6 +14,7 @@ fn must_not_block(err: HandshakeError) -> Error { fn handle_client(stream: TcpStream) -> Result<()> { let mut socket = accept(stream).map_err(must_not_block)?; + info!("Running test"); loop { match socket.read_message()? { msg @ Message::Text(_) | msg @ Message::Binary(_) => { @@ -31,11 +32,13 @@ fn main() { for stream in server.incoming() { spawn(move || match stream { - Ok(stream) => match handle_client(stream) { - Ok(_) => (), - Err(e) => warn!("Error in client: {}", e), + Ok(stream) => if let Err(err) = handle_client(stream) { + match err { + Error::ConnectionClosed | Error::Protocol(_) | Error::Utf8 => (), + e => error!("test: {}", e), + } }, - Err(e) => warn!("Error accepting stream: {}", e), + Err(e) => error!("Error accepting stream: {}", e), }); } }