Stop logging err when unix socket closed

This commit is contained in:
Daniel Sockwell 2020-01-10 17:41:14 -05:00
parent 74324c7ba1
commit 5a5bf41470
1 changed files with 9 additions and 1 deletions

View File

@ -48,7 +48,10 @@ pub fn send_updates_to_ws(
rx.map_err(|()| -> warp::Error { unreachable!() })
.forward(ws_tx)
.map(|_r| ())
.map_err(|e| eprintln!("websocket send error: {}", e)),
.map_err(|e| match e.to_string().as_ref() {
"IO error: Broken pipe (os error 32)" => (), // just closed unix socket
_ => log::warn!("websocket send error: {}", e),
}),
);
// Yield new events for as long as the client is still connected
@ -60,6 +63,11 @@ pub fn send_updates_to_ws(
log::info!("Client closed WebSocket connection");
futures::future::ok(false)
}
Err(e) if e.to_string() == "IO error: Broken pipe (os error 32)" => {
// no err, just closed Unix socket
log::info!("Client closed WebSocket connection");
futures::future::ok(false)
}
Err(e) => {
log::warn!("{}", e);
futures::future::ok(false)