diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-10-28 01:17:12 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-10-28 01:17:12 +0000 |
commit | caad4b20755d3ba0ea172c58fd0b7cffae84733d (patch) | |
tree | 7bfe46fe7228695281684eb170b8082221244695 /pkg/tcpip/transport | |
parent | 118b6a7764448d701d3170e1a167ec8e533b42b5 (diff) | |
parent | 24c33de748425e918033267313a4414b8ceb9727 (diff) |
Merge release-20201019.0-74-g24c33de74 (automated)
Diffstat (limited to 'pkg/tcpip/transport')
-rw-r--r-- | pkg/tcpip/transport/udp/endpoint.go | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/pkg/tcpip/transport/udp/endpoint.go b/pkg/tcpip/transport/udp/endpoint.go index d31177eb7..cdb5127ab 100644 --- a/pkg/tcpip/transport/udp/endpoint.go +++ b/pkg/tcpip/transport/udp/endpoint.go @@ -1369,6 +1369,12 @@ func (e *endpoint) Readiness(mask waiter.EventMask) waiter.EventMask { e.rcvMu.Unlock() } + e.lastErrorMu.Lock() + hasError := e.lastError != nil + e.lastErrorMu.Unlock() + if hasError { + result |= waiter.EventErr + } return result } @@ -1468,14 +1474,16 @@ func (e *endpoint) HandlePacket(r *stack.Route, id stack.TransportEndpointID, pk func (e *endpoint) HandleControlPacket(id stack.TransportEndpointID, typ stack.ControlType, extra uint32, pkt *stack.PacketBuffer) { if typ == stack.ControlPortUnreachable { e.mu.RLock() - defer e.mu.RUnlock() - if e.state == StateConnected { e.lastErrorMu.Lock() - defer e.lastErrorMu.Unlock() - e.lastError = tcpip.ErrConnectionRefused + e.lastErrorMu.Unlock() + e.mu.RUnlock() + + e.waiterQueue.Notify(waiter.EventErr) + return } + e.mu.RUnlock() } } |