From a04c8ad4cee876a8dc5ebab43c0a4759602841d9 Mon Sep 17 00:00:00 2001 From: Kevin Krakauer Date: Fri, 23 Oct 2020 15:44:22 -0700 Subject: iptables testing: handle EINTR on calls to accept(). This caused test flakes. PiperOrigin-RevId: 338758723 --- test/iptables/nat.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'test') 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. -- cgit v1.2.3