mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-10 13:04:23 -04:00
Treat events with fd == -1 as addable.
This turns out to simplify a fair bit of logic, including the bufferevent code, and should fix bug 2850656. svn:r1431
This commit is contained in:
parent
85255a6397
commit
c2ead9f173
@ -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 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 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 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:
|
Changes in 2.0.2-alpha:
|
||||||
|
6
evmap.c
6
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
|
/*XXX(nickm) Should we assert that ev is not already inserted, or should
|
||||||
* we make this function idempotent? */
|
* we make this function idempotent? */
|
||||||
|
|
||||||
|
if (fd < 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
#ifndef EVMAP_USE_HT
|
#ifndef EVMAP_USE_HT
|
||||||
if (fd >= io->nentries) {
|
if (fd >= io->nentries) {
|
||||||
if (evmap_make_space(io, fd, sizeof(struct evmap_io *)) == -1)
|
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;
|
int nread, nwrite;
|
||||||
short res = 0, old = 0;
|
short res = 0, old = 0;
|
||||||
|
|
||||||
|
if (fd < 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
assert(fd == ev->ev_fd); /*XXX(nickm) always true? */
|
assert(fd == ev->ev_fd); /*XXX(nickm) always true? */
|
||||||
/*XXX(nickm) Should we assert that ev is not already inserted, or should
|
/*XXX(nickm) Should we assert that ev is not already inserted, or should
|
||||||
* we make this function idempotent? */
|
* we make this function idempotent? */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user