mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-05 13:05:45 +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,11 +864,21 @@ mod tests {
|
|||||||
)
|
)
|
||||||
.expect("Cannot add 'tcp_listener' event to epoll");
|
.expect("Cannot add 'tcp_listener' event to epoll");
|
||||||
let mut events = vec![epoll::Event::new(epoll::Events::empty(), 0); 1];
|
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[..])
|
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)?;
|
.map_err(Error::EpollWait)?;
|
||||||
if num_events == 0 {
|
if num_events == 0 {
|
||||||
return Err(Error::EpollWaitTimeout);
|
return Err(Error::EpollWaitTimeout);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
match listener.accept() {
|
match listener.accept() {
|
||||||
Ok((mut stream, addr)) => {
|
Ok((mut stream, addr)) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user