From e5fe488b22734e798df760d9646c6b1c5f25c207 Mon Sep 17 00:00:00 2001 From: Bhasker Hariharan Date: Tue, 22 Jun 2021 23:38:37 -0700 Subject: Wake up Writers when tcp socket is shutdown for writes. PiperOrigin-RevId: 380967023 --- pkg/tcpip/transport/tcp/endpoint.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'pkg') diff --git a/pkg/tcpip/transport/tcp/endpoint.go b/pkg/tcpip/transport/tcp/endpoint.go index a27e2110b..242e6b7f8 100644 --- a/pkg/tcpip/transport/tcp/endpoint.go +++ b/pkg/tcpip/transport/tcp/endpoint.go @@ -2372,6 +2372,9 @@ func (e *endpoint) shutdownLocked(flags tcpip.ShutdownFlags) tcpip.Error { e.notifyProtocolGoroutine(notifyTickleWorker) return nil } + // Wake up any readers that maybe waiting for the stream to become + // readable. + e.waiterQueue.Notify(waiter.ReadableEvents) } // Close for write. @@ -2394,6 +2397,9 @@ func (e *endpoint) shutdownLocked(flags tcpip.ShutdownFlags) tcpip.Error { e.sndQueueInfo.SndClosed = true e.sndQueueInfo.sndQueueMu.Unlock() e.handleClose() + // Wake up any writers that maybe waiting for the stream to become + // writable. + e.waiterQueue.Notify(waiter.WritableEvents) } return nil -- cgit v1.2.3