about summary refs log tree commit diff
path: root/src/libnative
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-03-12 17:04:34 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-03-13 15:52:37 -0700
commita63deeb3d32fc21f36d484d62a3ea1d3d0c82500 (patch)
tree09421405ec3085de6217dfdef14cc119fd6da596 /src/libnative
parent3316a0e6b2ad9352bab58e7c046ef3d212411d82 (diff)
downloadrust-a63deeb3d32fc21f36d484d62a3ea1d3d0c82500.tar.gz
rust-a63deeb3d32fc21f36d484d62a3ea1d3d0c82500.zip
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.
Diffstat (limited to 'src/libnative')
-rw-r--r--src/libnative/io/net.rs5
1 files changed, 5 insertions, 0 deletions
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 {