From a63deeb3d32fc21f36d484d62a3ea1d3d0c82500 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 12 Mar 2014 17:04:34 -0700 Subject: io: Bind to shutdown() for TCP streams This is something that is plausibly useful, and is provided by libuv. This is not currently surfaced as part of the `TcpStream` type, but it may possibly appear in the future. For now only the raw functionality is provided through the Rtio objects. --- src/libnative/io/net.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/libnative') diff --git a/src/libnative/io/net.rs b/src/libnative/io/net.rs index 7445e4c0992..6a711072942 100644 --- a/src/libnative/io/net.rs +++ b/src/libnative/io/net.rs @@ -351,6 +351,11 @@ impl rtio::RtioTcpStream for TcpStream { fn clone(&self) -> ~rtio::RtioTcpStream { ~TcpStream { inner: self.inner.clone() } as ~rtio::RtioTcpStream } + fn close_write(&mut self) -> IoResult<()> { + super::mkerr_libc(unsafe { + libc::shutdown(self.fd(), libc::SHUT_WR) + }) + } } impl rtio::RtioSocket for TcpStream { -- cgit 1.4.1-3-g733a5