mirror of
https://github.com/actix/actix-web.git
synced 2024-11-26 19:41:12 +00:00
sleep on accept socket error
This commit is contained in:
parent
1db1ce1ca3
commit
af8875f6ab
1 changed files with 5 additions and 0 deletions
|
@ -618,6 +618,9 @@ fn start_accept_thread(sock: net::TcpListener, addr: net::SocketAddr, backlog: i
|
||||||
// Create storage for events
|
// Create storage for events
|
||||||
let mut events = mio::Events::with_capacity(128);
|
let mut events = mio::Events::with_capacity(128);
|
||||||
|
|
||||||
|
// Sleep on error
|
||||||
|
let sleep = Duration::from_millis(100);
|
||||||
|
|
||||||
let mut next = 0;
|
let mut next = 0;
|
||||||
loop {
|
loop {
|
||||||
if let Err(err) = poll.poll(&mut events, None) {
|
if let Err(err) = poll.poll(&mut events, None) {
|
||||||
|
@ -641,6 +644,8 @@ fn start_accept_thread(sock: net::TcpListener, addr: net::SocketAddr, backlog: i
|
||||||
if err.kind() != io::ErrorKind::WouldBlock {
|
if err.kind() != io::ErrorKind::WouldBlock {
|
||||||
error!("Error accepting connection: {:?}", err);
|
error!("Error accepting connection: {:?}", err);
|
||||||
}
|
}
|
||||||
|
// sleep after error
|
||||||
|
thread::sleep(sleep);
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue