mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 16:02:59 +01:00
sleep on accept socket error
This commit is contained in:
parent
1db1ce1ca3
commit
af8875f6ab
@ -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 New Issue
Block a user