diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-09-27 20:16:08 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-09-27 20:16:08 +0000 |
commit | de86fb500484540562ad094c136a9cf39c684103 (patch) | |
tree | 0223b17e6398ee701750be42ad3758b0ca16b4a8 | |
parent | 1d629affef6e7132fea1b6744ea2610e4d4f4e04 (diff) | |
parent | 455924ee1b148002df9950558b07f049360212d1 (diff) |
Merge release-20210921.0-33-g455924ee1 (automated)
-rw-r--r-- | pkg/tcpip/transport/tcp/accept.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/pkg/tcpip/transport/tcp/accept.go b/pkg/tcpip/transport/tcp/accept.go index 7115d0a12..7348bb7a9 100644 --- a/pkg/tcpip/transport/tcp/accept.go +++ b/pkg/tcpip/transport/tcp/accept.go @@ -109,9 +109,9 @@ type listenContext struct { // pending is used to wait for all pendingEndpoints to finish when // a socket is closed. pending sync.WaitGroup - // pendingEndpoints is a map of all endpoints for which a handshake is + // pendingEndpoints is a set of all endpoints for which a handshake is // in progress. - pendingEndpoints map[stack.TransportEndpointID]*endpoint + pendingEndpoints map[*endpoint]struct{} } // timeStamp returns an 8-bit timestamp with a granularity of 64 seconds. @@ -129,7 +129,7 @@ func newListenContext(stk *stack.Stack, protocol *protocol, listenEP *endpoint, v6Only: v6Only, netProto: netProto, listenEP: listenEP, - pendingEndpoints: make(map[stack.TransportEndpointID]*endpoint), + pendingEndpoints: make(map[*endpoint]struct{}), } for i := range l.nonce { @@ -338,21 +338,21 @@ func (l *listenContext) performHandshake(s *segment, opts header.TCPSynOptions, func (l *listenContext) addPendingEndpoint(n *endpoint) { l.pendingMu.Lock() - l.pendingEndpoints[n.TransportEndpointInfo.ID] = n + l.pendingEndpoints[n] = struct{}{} l.pending.Add(1) l.pendingMu.Unlock() } func (l *listenContext) removePendingEndpoint(n *endpoint) { l.pendingMu.Lock() - delete(l.pendingEndpoints, n.TransportEndpointInfo.ID) + delete(l.pendingEndpoints, n) l.pending.Done() l.pendingMu.Unlock() } func (l *listenContext) closeAllPendingEndpoints() { l.pendingMu.Lock() - for _, n := range l.pendingEndpoints { + for n := range l.pendingEndpoints { n.notifyProtocolGoroutine(notifyClose) } l.pendingMu.Unlock() |