If what == EPOLLRDHUP | EPOLLIN, this code returns EV_READ | EV_WRITE | EV_EOF. Wouldn't EV_READ | EV_EOF make more sense (you can read from this socket and there's also an EOF).