mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 11:22:26 +00:00
tests: integration: Retry epoll if we receive -EINTR or -EAGAIN
On the CI we are seeing that sometimes the epoll is receiving these errors which do not indicate a failure but that we should retry. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
60d2469e7a
commit
06f391e022
@ -864,10 +864,20 @@ mod tests {
|
||||
)
|
||||
.expect("Cannot add 'tcp_listener' event to epoll");
|
||||
let mut events = vec![epoll::Event::new(epoll::Events::empty(), 0); 1];
|
||||
let num_events = epoll::wait(epoll_fd, timeout * 1000 as i32, &mut events[..])
|
||||
.map_err(Error::EpollWait)?;
|
||||
if num_events == 0 {
|
||||
return Err(Error::EpollWaitTimeout);
|
||||
loop {
|
||||
let num_events =
|
||||
match epoll::wait(epoll_fd, timeout * 1000 as i32, &mut events[..]) {
|
||||
Ok(num_events) => Ok(num_events),
|
||||
Err(e) => match e.raw_os_error() {
|
||||
Some(libc::EAGAIN) | Some(libc::EINTR) => continue,
|
||||
_ => Err(e),
|
||||
},
|
||||
}
|
||||
.map_err(Error::EpollWait)?;
|
||||
if num_events == 0 {
|
||||
return Err(Error::EpollWaitTimeout);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
match listener.accept() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user