After two or more events have been registered for the same file
descriptor using EV_ET, if one of the events is deleted, then the
epoll_ctl() call issued by libevent drops the EPOLLET flag resulting in
level triggered notifications.
[ azat: use existing "et" in the evmap_io_del_() ]
ch.old_events = old;
ch.read_change = ch.write_change = ch.close_change = 0;
if (events & EV_WRITE)
- ch.write_change = EV_CHANGE_DEL;
+ ch.write_change = EV_CHANGE_DEL |
+ (events & EV_ET);
if (events & EV_READ)
- ch.read_change = EV_CHANGE_DEL;
+ ch.read_change = EV_CHANGE_DEL |
+ (events & EV_ET);
if (events & EV_CLOSED)
- ch.close_change = EV_CHANGE_DEL;
+ ch.close_change = EV_CHANGE_DEL |
+ (events & EV_ET);
return epoll_apply_one_change(base, base->evbase, &ch);
}
if (res) {
void *extra = ((char*)ctx) + sizeof(struct evmap_io);
- if (evsel->del(base, ev->ev_fd, old, res, extra) == -1) {
+ if (evsel->del(base, ev->ev_fd,
+ old, (ev->ev_events & EV_ET) | res, extra) == -1) {
retval = -1;
} else {
retval = 1;