mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
tcpip/udp: document preconditions for endpoint.closeLocked()
This commit is contained in:
@@ -160,11 +160,16 @@ func (e *endpoint) Abort() {
|
||||
// associated with it.
|
||||
func (e *endpoint) Close() {
|
||||
e.mu.Lock()
|
||||
e.closeLocked()
|
||||
e.mu.Unlock()
|
||||
}
|
||||
|
||||
// Preconditions: e.mu is locked.
|
||||
// +checklocks:e.mu
|
||||
func (e *endpoint) closeLocked() {
|
||||
switch state := e.net.State(); state {
|
||||
case transport.DatagramEndpointStateInitial:
|
||||
case transport.DatagramEndpointStateClosed:
|
||||
e.mu.Unlock()
|
||||
return
|
||||
case transport.DatagramEndpointStateBound, transport.DatagramEndpointStateConnected:
|
||||
id := e.net.Info().ID
|
||||
@@ -201,7 +206,6 @@ func (e *endpoint) Close() {
|
||||
e.net.Shutdown()
|
||||
e.net.Close()
|
||||
e.readShutdown = true
|
||||
e.mu.Unlock()
|
||||
|
||||
e.waiterQueue.Notify(waiter.EventHUp | waiter.EventErr | waiter.ReadableEvents | waiter.WritableEvents)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user