Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions library/std/src/sys/wasi/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,14 @@ impl TcpStream {
unsupported()
}

pub fn shutdown(&self, _: Shutdown) -> io::Result<()> {
unsupported()
pub fn shutdown(&self, how: Shutdown) -> io::Result<()> {
let wasi_how = match how {
Shutdown::Read => wasi::SDFLAGS_RD,
Shutdown::Write => wasi::SDFLAGS_WR,
Shutdown::Both => wasi::SDFLAGS_RD | wasi::SDFLAGS_WR,
};

unsafe { wasi::sock_shutdown(self.socket().as_raw_fd() as _, wasi_how).map_err(err2io) }
}

pub fn duplicate(&self) -> io::Result<TcpStream> {
Expand Down