Skip to content

Commit c124952

Browse files
committed
check EV_EOF first
1 parent ad0ce71 commit c124952

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/detail/io_notifier_kqueue.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ auto io_notifier_kqueue::next_events(
156156

157157
auto io_notifier_kqueue::event_to_poll_status(const event_t& event) -> poll_status
158158
{
159+
if (event.flags & EV_EOF)
160+
{
161+
return poll_status::closed;
162+
}
163+
159164
if (event.filter & EVFILT_READ || event.filter & EVFILT_WRITE)
160165
{
161166
return poll_status::event;
@@ -164,10 +169,6 @@ auto io_notifier_kqueue::event_to_poll_status(const event_t& event) -> poll_stat
164169
{
165170
return poll_status::error;
166171
}
167-
else if (event.flags & EV_EOF)
168-
{
169-
return poll_status::closed;
170-
}
171172
throw std::runtime_error{"invalid kqueue state"};
172173
}
173174

0 commit comments

Comments
 (0)