retry on EINTR in accept loop

This commit is contained in:
lishuo 2021-02-03 21:43:40 +08:00
parent 4a8693d000
commit 0bfa947d6e
1 changed files with 7 additions and 3 deletions

View File

@ -161,9 +161,13 @@ impl Accept {
let mut events = mio::Events::with_capacity(128); let mut events = mio::Events::with_capacity(128);
loop { loop {
self.poll if let Err(e) = self.poll.poll(&mut events, None) {
.poll(&mut events, None) if matches!(e.kind(), std::io::ErrorKind::Interrupted) {
.unwrap_or_else(|e| panic!("Poll error: {}", e)); continue;
} else {
panic!("Poll error: {}", e);
}
}
for event in events.iter() { for event in events.iter() {
let token = event.token(); let token = event.token();