diff --git a/CHANGES.md b/CHANGES.md index 75a29d5d..a1e2ed49 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,8 @@ * Fix steraming response handling for http/2 +* Better sleep on error support + ## 0.4.6 (2018-03-10) diff --git a/src/server/srv.rs b/src/server/srv.rs index c578331b..8ba058b3 100644 --- a/src/server/srv.rs +++ b/src/server/srv.rs @@ -741,10 +741,9 @@ fn start_accept_thread( break } }, - Err(err) => { - if err.kind() != io::ErrorKind::WouldBlock { - error!("Error accepting connection: {:?}", err); - } + Err(ref e) if connection_error(e) => continue, + Err(e) => { + error!("Error accepting connection: {:?}", e); // sleep after error thread::sleep(sleep); break @@ -818,3 +817,16 @@ fn create_tcp_listener(addr: net::SocketAddr, backlog: i32) -> io::Result bool { + e.kind() == io::ErrorKind::ConnectionRefused || + e.kind() == io::ErrorKind::ConnectionAborted || + e.kind() == io::ErrorKind::ConnectionReset +}