We do this by not allocating the maximum epoll_event array for the epoll
backend at startup. Instead, we start out accepting 32 events at a time, and
double the array's size when it seems that the OS is generating events faster
than we're requesting them. This saves up to 374K per epoll-based
event_base. Resolves bug 2839240.
svn:r1428
Previously, if we had a socket bufferevent in connect state, we'd send
both of these to indicate that the connection was done. That was broken
since the point of adding BEV_EVENT_CONNECTED was so that we could
distinguish "we're connected" and "we wrote something".
Now, writecb is called only when
A) the connection finished but the user never put the socket into a
"connecting" state, or
B) data was actually written.
svn:r1425
We need to comb the rest of the code to make sure that we don't blindly wrap
functions in LOCK(x), UNLOCK(x) when those functions might contain a FREE(x)
in the middle.
Rocco Carbone found and reported this bug.
svn:r1384
This code adds a new Bufferevent type that is only compiled when the
openssl library is present. It supports using an SSL object and an
event alert mechanism, which can either be an fd or an underlying
bufferevent.
There is still more work to do: the unit tests are incomplete, and we
need to support flush and shutdown much better. Sometimes events are
generated needlessly: this will hose performance.
There's a new encrypting proxy in sample/le-proxy.c.
This code has only been tested on OSX, and nowhere else.
svn:r1382
They're now called evtag_encode_int(64). The old names are available
as macros in event2/tag_compat.h.
Also, add unit tests for encode/decode_int64.
svn:r1365
Previously, events that were disabled using EVENT_NO* were left out of
event_get_supported_methods(). This was wrong, broke unit tests
(under some circumstances) and left the user with no good way to tell
which methods were actually compiled in.
Fixes bug 2821015.
svn:r1344
This gives you the property that once you have called event_del(E),
you know that E is no longer running or pending or active at all, and
so it is safe to delete the resource used by E's callback.
svn:r1341
Patch from Zack Weinberg. His message:
This one eliminates all use of AC_CHECK_LIB in the configure script.
AC_CHECK_LIB has a serious flaw: if the library you mention *exists*
but is not *necessary* for the function you want, it adds it to
$(LIBS) anyway. This was fine in the days of static libraries,
because the linker would ignore an .a library that didn't contain
anything you needed. However, ELF shared libraries are different
(let's not get into why): the linker will by default record a
DT_NEEDED entry for every shared object mentioned on the link
command line. Thus, every use of AC_CHECK_LIB is a potential
unnecessary DT_NEEDED, making extra work for the dynamic loader. The
cure is simply to use AC_SEARCH_LIBS instead; it first tries to find
the function you ask for in libc, and only if that doesn't work does
it try to use the extra library you mention.
For the same reasons, pkg-config .pc files should distinguish
between the libraries to use for shared linkage (Libs:) and the
additional libraries needed for static linkage (Libs.private:). I
have also made that correction in this patch. I also took the
opportunity to clean up the substitution variables a little and make
absolutely sure that the core library does not get linked against
zlib.
svn:r1338
This fixes part of bug 2800642, I believe, though there is still a
general race condition in multithreaded use of events that we need to
think about.
svn:r1337
New backends like poll and kqueue and so on add fds to the queue in
the order that they are triggered. But the select backend currently
activates low-numbered fds first, whereas the poll and win32 backends
currently favor whatever fds have been on for the longest. This is no
good for fairness.
svn:r1318
Some win32 systems (mostly those using Kaspersky, it would seem)
prevent us from faking socketpair(). This makes our signal
notification code just not work. Our response since 1.4 has been to
assert. For users who would rather work without signals than not work
at all, this has been a regression from 1.3e.
This patch makes adding signal events fail in this case; there's no
reason to kill the whole process.
svn:r1303
Previously, set_flags() would replace all previous user-visible flags.
Now it just sets the flags, and there is a clear_flags() function to
clear other flags.
svn:r1293
OpenSSL uses something like this to implement get/set access for
properties on its BIOs, so that it doesn't need to add a pair of
get/set functions to the vtable struct for every new abstract property
it provides an accessor for.
Doing this lets us make bufferevent_setfd abstract, and implement an
abstract bufferevent_getfd.
svn:r1284
This is a bit of an interface doozy, but it's really needed in order
to be able to document this stuff without apologizing it. This patch
does the following renamings:
evbuffercb -> bufferevent_data_cb
everrorcb -> bufferevent_event_cb
EVBUFFER_(READ,WRITE,...) -> BEV_EVENT_(...)
EVBUFFER_(INPUT,OUTPUT) -> bufferevent_get_(input,output)
All the old names are available in event2/bufferevent_compat.h
svn:r1283
This is stuff that it's easy to get wrong (as I noticed when writing
bench_http), and that takes up a fair amount of space (see http.c).
Also, it's something that we'll eventually want to abstract to use
IOCP, where available.
svn:r1272