diff options
author | Kevin Krakauer <krakauer@google.com> | 2020-10-23 15:44:22 -0700 |
---|---|---|
committer | Nicolas Lacasse <nlacasse@google.com> | 2020-10-23 16:13:01 -0700 |
commit | a04c8ad4cee876a8dc5ebab43c0a4759602841d9 (patch) | |
tree | 70c43f6272a53570513c730ecb8d2f2bf3fd5b64 /test | |
parent | e5c1b035ab3bbbbaf187d746f858ddd0a859602a (diff) |
iptables testing: handle EINTR on calls to accept().
This caused test flakes.
PiperOrigin-RevId: 338758723
Diffstat (limited to 'test')
-rw-r--r-- | test/iptables/nat.go | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/test/iptables/nat.go b/test/iptables/nat.go index dd9a18339..b98d99fb8 100644 --- a/test/iptables/nat.go +++ b/test/iptables/nat.go @@ -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. |