From 80fda110a2fe4db272156f39461419f7868b7cb8 Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Mon, 25 Jul 2022 14:26:34 -0400 Subject: [PATCH] tcp: re-enable half-duplex operation support (#46088) Refs: #42005 (cherry picked from commit 69e319d005d812dbc4442b08fc9e8ea6a2ade110) --- base/stream.jl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/base/stream.jl b/base/stream.jl index cee4894b28c3c..0c902cd6fd946 100644 --- a/base/stream.jl +++ b/base/stream.jl @@ -662,8 +662,11 @@ function uv_readcb(handle::Ptr{Cvoid}, nread::Cssize_t, buf::Ptr{Cvoid}) elseif nread == UV_EOF # libuv called uv_stop_reading already if stream.status != StatusClosing stream.status = StatusEOF - if stream isa TTY # TODO: || ccall(:uv_is_writable, Cint, (Ptr{Cvoid},), stream.handle) != 0 - # stream can still be used either by reseteof # TODO: or write + if stream isa TTY + # stream can still be used by reseteof (or possibly write) + notify(stream.cond) + elseif !(stream isa PipeEndpoint) && ccall(:uv_is_writable, Cint, (Ptr{Cvoid},), stream.handle) != 0 + # stream can still be used by write notify(stream.cond) else # underlying stream is no longer useful: begin finalization