diff --git a/ChangeLog b/ChangeLog index afc04bd5..5d2dd4c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,7 @@ Changes in 2.0.3-alpha: o If the kernel tells us that there are a negative number of bytes to read from a socket, do not believe it. Fixes bug 2841177; found by Alexander Pronchenkov. o Do not detect whether we have monotonic clock support every time a new event base is created: instead do it only once. Patch taken from Chromium. o Do not allocate the maximum event queue for the epoll backend at startup. Instead, start out accepting 32 events at a time, and double the queue's size when it seems that the OS is generating events faster than we're requesting them. Saves up to 374K per epoll-based event_base. Resolves bug 2839240. + o Treat an event with a negative fd as valid but untriggerable by Libevent. This is useful for applications that want to manually activate events. Changes in 2.0.2-alpha: diff --git a/evmap.c b/evmap.c index 47bea3ce..eb714b4b 100644 --- a/evmap.c +++ b/evmap.c @@ -267,6 +267,9 @@ evmap_io_add(struct event_base *base, int fd, struct event *ev) /*XXX(nickm) Should we assert that ev is not already inserted, or should * we make this function idempotent? */ + if (fd < 0) + return 0; + #ifndef EVMAP_USE_HT if (fd >= io->nentries) { if (evmap_make_space(io, fd, sizeof(struct evmap_io *)) == -1) @@ -319,6 +322,9 @@ evmap_io_del(struct event_base *base, int fd, struct event *ev) int nread, nwrite; short res = 0, old = 0; + if (fd < 0) + return 0; + assert(fd == ev->ev_fd); /*XXX(nickm) always true? */ /*XXX(nickm) Should we assert that ev is not already inserted, or should * we make this function idempotent? */