diff --git a/src/net/tcp/stream.rs b/src/net/tcp/stream.rs index 7952964f..ef9bc500 100644 --- a/src/net/tcp/stream.rs +++ b/src/net/tcp/stream.rs @@ -343,6 +343,7 @@ impl Write for TcpStream { } fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + self.shutdown(std::net::Shutdown::Write)?; Pin::new(&mut &*self).poll_close(cx) } } diff --git a/src/os/unix/net/stream.rs b/src/os/unix/net/stream.rs index 86063c23..eb4cd4ec 100644 --- a/src/os/unix/net/stream.rs +++ b/src/os/unix/net/stream.rs @@ -192,6 +192,7 @@ impl Write for UnixStream { } fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + self.shutdown(std::net::Shutdown::Write)?; Pin::new(&mut &*self).poll_close(cx) } }