Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[bugfix] kqueue backend used to pass wrong _revents_ to callback

  • Loading branch information...
commit 6ed894e0ee551c3a00637db9f56ded5d981ce9b8 1 parent a8565c4
@kazuho authored
Showing with 15 additions and 5 deletions.
  1. +15 −5 picoev_kqueue.c
View
20 picoev_kqueue.c
@@ -186,11 +186,21 @@ int picoev_poll_once_internal(picoev_loop* _loop, int max_wait)
picoev_fd* target = picoev.fds + event->ident;
assert((event->flags & EV_ERROR) == 0); /* changelist errors are fatal */
if (loop->loop.loop_id == target->loop_id
- && (event->flags & (EVFILT_READ | EVFILT_WRITE)) != 0) {
- int revents = ((event->flags & EVFILT_READ) != 0 ? PICOEV_READ : 0)
- | ((event->flags & EVFILT_WRITE) != 0 ? PICOEV_WRITE : 0);
- (*target->callback)(&loop->loop, event->ident, revents,
- target->cb_arg);
+ && (event->filter & (EVFILT_READ | EVFILT_WRITE)) != 0) {
+ int revents;
+ switch (event->filter) {
+ case EVFILT_READ:
+ revents = PICOEV_READ;
+ break;
+ case EVFILT_WRITE:
+ revents = PICOEV_WRITE;
+ break;
+ default:
+ assert(0);
+ revents = 0; // suppress compiler warning
+ break;
+ }
+ (*target->callback)(&loop->loop, event->ident, revents, target->cb_arg);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.