From f73fad834f099cf866b2fe971485773727b83cb1 Mon Sep 17 00:00:00 2001 From: Bhasker Hariharan Date: Fri, 23 Oct 2020 11:18:53 -0700 Subject: Fix TestTCPTimeWaitNewSyn. Drain the notification channel after first accept as in case the first accept never blocked then the notification for the first accept will still be in the channel causing the second accept to fail as it will try to wait on the channel and return immediately due to the older notification even though there is no connection yet in the accept queue. PiperOrigin-RevId: 338710062 --- pkg/tcpip/transport/tcp/tcp_test.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'pkg/tcpip/transport/tcp') diff --git a/pkg/tcpip/transport/tcp/tcp_test.go b/pkg/tcpip/transport/tcp/tcp_test.go index 93a580bad..5f05608e2 100644 --- a/pkg/tcpip/transport/tcp/tcp_test.go +++ b/pkg/tcpip/transport/tcp/tcp_test.go @@ -6725,6 +6725,13 @@ func TestTCPTimeWaitNewSyn(t *testing.T) { c.CheckNoPacketTimeout("unexpected packet received in response to SYN", 1*time.Second) + // drain any older notifications from the notification channel before attempting + // 2nd connection. + select { + case <-ch: + default: + } + // Send a SYN request w/ sequence number higher than // the highest sequence number sent. iss = seqnum.Value(792) -- cgit v1.2.3