summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/transport/tcp/accept.go
diff options
context:
space:
mode:
authorTamir Duberstein <tamird@google.com>2021-09-29 13:43:12 -0700
committergVisor bot <gvisor-bot@google.com>2021-09-29 13:45:47 -0700
commitf4340b0c9fc24aee34b00073f6be5b38a2d09bce (patch)
tree5c5d7f7ef17846d6caa05e8ee561e9032f1856c2 /pkg/tcpip/transport/tcp/accept.go
parent36b36a8a73bf7df1322e6c6b94bf23401219458b (diff)
Avoid comparisons to zero value of acceptQueue
PiperOrigin-RevId: 399765414
Diffstat (limited to 'pkg/tcpip/transport/tcp/accept.go')
-rw-r--r--pkg/tcpip/transport/tcp/accept.go6
1 files changed, 2 insertions, 4 deletions
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() {