mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Notify UDP and Ping endpoints on close
PiperOrigin-RevId: 203883138 Change-Id: I7500c0a70f5d71c3fb37e2477f7fc466fa92fd3e
This commit is contained in:
@@ -92,7 +92,6 @@ func newEndpoint(stack *stack.Stack, netProto tcpip.NetworkProtocolNumber, waite
|
||||
// associated with it.
|
||||
func (e *endpoint) Close() {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
|
||||
switch e.state {
|
||||
case stateBound, stateConnected:
|
||||
@@ -113,6 +112,10 @@ func (e *endpoint) Close() {
|
||||
|
||||
// Update the state.
|
||||
e.state = stateClosed
|
||||
|
||||
e.mu.Unlock()
|
||||
|
||||
e.waiterQueue.Notify(waiter.EventHUp | waiter.EventErr | waiter.EventIn | waiter.EventOut)
|
||||
}
|
||||
|
||||
// Read reads data from the endpoint. This method does not block if
|
||||
|
||||
@@ -121,7 +121,6 @@ func NewConnectedEndpoint(stack *stack.Stack, r *stack.Route, id stack.Transport
|
||||
// associated with it.
|
||||
func (e *endpoint) Close() {
|
||||
e.mu.Lock()
|
||||
defer e.mu.Unlock()
|
||||
|
||||
switch e.state {
|
||||
case stateBound, stateConnected:
|
||||
@@ -142,6 +141,10 @@ func (e *endpoint) Close() {
|
||||
|
||||
// Update the state.
|
||||
e.state = stateClosed
|
||||
|
||||
e.mu.Unlock()
|
||||
|
||||
e.waiterQueue.Notify(waiter.EventHUp | waiter.EventErr | waiter.EventIn | waiter.EventOut)
|
||||
}
|
||||
|
||||
// Read reads data from the endpoint. This method does not block if
|
||||
|
||||
Reference in New Issue
Block a user