mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
netstack: make listening tcp socket close state setting and cleanup atomic.
Otherwise the socket saving logic might find workers still running for closed sockets unexpectedly. PiperOrigin-RevId: 210018905 Change-Id: I443a04d355613f5f9983252cc6863bff6e0eda3a
This commit is contained in:
@@ -363,11 +363,6 @@ func (e *endpoint) protocolListenLoop(rcvWnd seqnum.Size) *tcpip.Error {
|
||||
e.mu.Lock()
|
||||
e.state = stateClosed
|
||||
|
||||
// Notify waiters that the endpoint is shutdown.
|
||||
e.mu.Unlock()
|
||||
e.waiterQueue.Notify(waiter.EventIn | waiter.EventOut)
|
||||
e.mu.Lock()
|
||||
|
||||
// Do cleanup if needed.
|
||||
e.completeWorkerLocked()
|
||||
|
||||
@@ -375,6 +370,9 @@ func (e *endpoint) protocolListenLoop(rcvWnd seqnum.Size) *tcpip.Error {
|
||||
close(e.drainDone)
|
||||
}
|
||||
e.mu.Unlock()
|
||||
|
||||
// Notify waiters that the endpoint is shutdown.
|
||||
e.waiterQueue.Notify(waiter.EventIn | waiter.EventOut)
|
||||
}()
|
||||
|
||||
e.mu.Lock()
|
||||
|
||||
Reference in New Issue
Block a user