From f4340b0c9fc24aee34b00073f6be5b38a2d09bce Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Wed, 29 Sep 2021 13:43:12 -0700 Subject: Avoid comparisons to zero value of acceptQueue PiperOrigin-RevId: 399765414 --- pkg/tcpip/transport/tcp/accept.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'pkg/tcpip/transport/tcp/accept.go') diff --git a/pkg/tcpip/transport/tcp/accept.go b/pkg/tcpip/transport/tcp/accept.go index 52d121907..2a77f07cf 100644 --- a/pkg/tcpip/transport/tcp/accept.go +++ b/pkg/tcpip/transport/tcp/accept.go @@ -525,10 +525,8 @@ func (e *endpoint) handleListenSegment(ctx *listenContext, s *segment) tcpip.Err e.acceptMu.Lock() defer e.acceptMu.Unlock() for { - if e.acceptQueue == (acceptQueue{}) { - // If the listener has transitioned out of the listen state - // (accepted is the zero value), the new endpoint is reset - // instead. + // The listener is transitioning out of the Listen state; bail. + if e.acceptQueue.capacity == 0 { return false } if e.acceptQueue.isFull() { -- cgit v1.2.3