1
Fork 0

extend comments on HUP vs RDHUP

This commit is contained in:
Ralf Jung 2024-08-17 10:36:46 +02:00 committed by GitHub
parent f9a7d6ec6f
commit cab81d3fa9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View file

@ -71,6 +71,9 @@ pub struct EpollReadyEvents {
pub epollrdhup: bool,
/// For stream socket, this event merely indicates that the peer
/// closed its end of the channel.
/// Unlike epollrdhup, this should only be set when the stream is fully closed.
/// epollrdhup also gets set when only the write half is closed, which is possible
/// via `shutdown(_, SHUT_WR)`.
pub epollhup: bool,
}

View file

@ -69,7 +69,8 @@ impl FileDescription for SocketPair {
epoll_ready_events.epollout = true;
}
} else {
// Peer FD has been closed.
// Peer FD has been closed. This always sets both the RDHUP and HUP flags
// as we do not support `shutdown` that could be used to partially close the stream.
epoll_ready_events.epollrdhup = true;
epoll_ready_events.epollhup = true;
// Since the peer is closed, even if no data is available reads will return EOF and