We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 008bc1d commit e598af6Copy full SHA for e598af6
library/std/src/sys/wasi/net.rs
@@ -119,8 +119,14 @@ impl TcpStream {
119
unsupported()
120
}
121
122
- pub fn shutdown(&self, _: Shutdown) -> io::Result<()> {
123
- unsupported()
+ pub fn shutdown(&self, how: Shutdown) -> io::Result<()> {
+ let wasi_how = match how {
124
+ Shutdown::Read => wasi::SDFLAGS_RD,
125
+ Shutdown::Write => wasi::SDFLAGS_WR,
126
+ Shutdown::Both => wasi::SDFLAGS_RD | wasi::SDFLAGS_WR,
127
+ };
128
+
129
+ unsafe { wasi::sock_shutdown(self.socket().as_raw_fd() as _, wasi_how).map_err(err2io) }
130
131
132
pub fn duplicate(&self) -> io::Result<TcpStream> {
0 commit comments