Support TCP sockets HUP&RDHUP events

This commit is contained in:
Jianfeng Jiang
2024-10-24 09:24:10 +00:00
committed by Tate, Hongliang Tian
parent 00ffc5266d
commit dc06d7c37d
3 changed files with 78 additions and 10 deletions

View File

@ -511,11 +511,16 @@ impl Socket for StreamSocket {
fn shutdown(&self, cmd: SockShutdownCmd) -> Result<()> {
let state = self.read_updated_state();
match state.as_ref() {
State::Connected(connected_stream) => connected_stream.shutdown(cmd),
let res = match state.as_ref() {
State::Connected(connected_stream) => connected_stream.shutdown(cmd, &self.pollee),
// TODO: shutdown listening stream
_ => return_errno_with_message!(Errno::EINVAL, "cannot shutdown"),
}
};
drop(state);
poll_ifaces();
res
}
fn addr(&self) -> Result<SocketAddr> {