iptables testing: handle EINTR on calls to accept().

This caused test flakes.

PiperOrigin-RevId: 338758723
This commit is contained in:
Kevin Krakauer
2020-10-23 16:13:01 -07:00
committed by Nicolas Lacasse
parent e5c1b035ab
commit a04c8ad4ce
+11 -4
View File
@@ -577,11 +577,18 @@ func listenForRedirectedConn(ctx context.Context, ipv6 bool, originalDsts []net.
connCh := make(chan int)
errCh := make(chan error)
go func() {
connFD, _, err := syscall.Accept(sockfd)
if err != nil {
errCh <- err
for {
connFD, _, err := syscall.Accept(sockfd)
if errors.Is(err, syscall.EINTR) {
continue
}
if err != nil {
errCh <- err
return
}
connCh <- connFD
return
}
connCh <- connFD
}()
// Wait for accept() to return or for the context to finish.