kqueue: ignore write-end closed notifications (#3277)

The combination EVFILT_WRITE+EV_EOF is valid and indicates that the
reader has disconnected (called `shutdown(SHUT_RD)`). Probably very rare
in practice, but this seems more correct.

Issue noticed (for UV_DISCONNECT clients of uv_poll), while doing
research for https://github.com/libuv/libuv/pull/3250.
This commit is contained in:
Jameson Nash 2021-11-24 19:37:02 -05:00 committed by GitHub
parent 40bf9a89eb
commit abfc4f0b15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -326,6 +326,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
if (errno != ENOENT)
abort();
}
if ((ev->flags & EV_EOF) && (w->pevents & UV__POLLRDHUP))
revents |= UV__POLLRDHUP;
}
if (ev->filter == EV_OOBAND) {
@ -359,9 +361,6 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
if (ev->flags & EV_ERROR)
revents |= POLLERR;
if ((ev->flags & EV_EOF) && (w->pevents & UV__POLLRDHUP))
revents |= UV__POLLRDHUP;
if (revents == 0)
continue;