| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Documentation for `bufferevent_compat.h` and `rpc.h` is not generated
since the `@file` command is missing. It can be fixed by adding
`@file` in file comment block.
- The briefs of buffer.h,bufferevent.h and some other files are missing.
Adding `@brief` command can fix it.
- The parameters in the function declaration are different from the
parameters following the `@param` command.We should change them to the
same.
- Documentation of `watch.h` is not generated since `watch.h` has not
been added to the Doxyfile `INPUT` tag.
- Add link to the watch.h in event.h
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
[ @azat:
- add return heredoc for evbuffer_setcb()
- add unit test with event_set_mem_functions()
- look through the report from abi-compliance-checker/abi-dumper
]
Closes: #855
|
| |
| |
| |
| | |
Refs: https://github.com/libevent/libevent/issues/760#issuecomment-502345788
|
| |
| |
| |
| |
| |
| | |
This will allow to customize SO_RCVBUF/SO_SNDBUF for nameservers in this
evdns_base, you may want to adjust them if the kernel starts dropping
udp packages.
|
| | |
|
| |
| |
| |
| |
| |
| | |
So that ai_flags (such as AI_ADDRCONFIG) can be specified.
Closes: #193 (cherry-picked with conflicts resolved)
|
| |
| |
| |
| |
| |
| |
| |
| | |
Converting unsigned to size_t for size of memory objects allows
proper handling of very large heaps on 64 bit systems.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Closes: #799 (cherry-picked)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
User can define his own response method by calling
evhttp_set_ext_method_cmp() on the struct http, or
evhttp_connection_set_ext_method_cmp() on the connection.
We expose a new stucture `evhttp_ext_method` which is passed to the
callback if it's set. So any field can be modified, with some exceptions
(in evhttp_method_):
If the cmp function is set, it has the ability to modify method, and
flags. Other fields will be ignored. Flags returned are OR'd with the
current flags.
Based on changes to the #282 from: Mark Ellzey <socket@gmail.com>
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Adds two new callbacks: "prepare" watchers, which fire immediately
before we poll for I/O, and "check" watchers, which fire immediately
after we finish polling and before we process events. This allows other
event loops to be embedded into libevent's, and enables certain
performance monitoring.
Closes: #710
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- DNS_OPTION_NAMESERVERS_NO_DEFAULT
Do not "default" nameserver (i.e. "127.0.0.1:53") if there is no nameservers
in resolv.conf, (iff DNS_OPTION_NAMESERVERS is set)
- EVDNS_BASE_NAMESERVERS_NO_DEFAULT
If EVDNS_BASE_INITIALIZE_NAMESERVERS isset, do not add default
nameserver if there are no nameservers in resolv.conf (just set
DNS_OPTION_NAMESERVERS_NO_DEFAULT internally)
Fixes: #569
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Before this patch evbuffer always reads 4K at a time, while this is fine
most of time you can find an example when this will decrease throughput.
So add an API to change default limit:
- evbuffer_set_max_read()
- evbuffer_get_max_read()
And a notice that most of time default is sane.
|
| |
| |
| |
| |
| |
| |
| | |
WebDAV introduced new HTTP methods (RFC4918):
PROPFIND, PROPPATCH, MKCOL, LOCK, UNLOCK, COPY, MOVE.
Add support of the methods.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This patch allows to change timeout for next events read/write/connect
separatelly, using new API:
- client:
evhttp_connection_set_connect_timeout_tv() -- for connect
evhttp_connection_set_read_timeout_tv() -- for read
evhttp_connection_set_write_timeout_tv() -- for write
- server:
evhttp_set_read_timeout_tv() -- for read
evhttp_set_write_timeout_tv() -- for write
It also changes a logic a little, before there was next fallbacks which
does not handled in new API:
- HTTP_CONNECT_TIMEOUT
- HTTP_WRITE_TIMEOUT
- HTTP_READ_TIMEOUT
And introduce another internal flag (EVHTTP_CON_TIMEOUT_ADJUSTED) that
will be used in evrpc, which adjust evhttp_connection timeout only if it
is not default.
Fixes: #692
Fixes: #715
|
| |
| |
| |
| | |
Closes: #194 (cherry-pick)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Although `_GNU_SOURCE` can be defined as an arbitrary #define per the
glibc docs [1], it's best to define it in a manner consistent with the way
that autoconf defines it, i.e., `1`.
While this shouldn't matter in most cases, it does when the headers from
other projects follow the poorly defined GNU convention implemented by
autoconf and are included after the libevent's util.h header. An example
failure with clang, similar to the failure I encountered, is as follows:
```
$ printf "#define _GNU_SOURCE\n#define _GNU_SOURCE 1" | clang -c -x c -
<stdin>:2:9: warning: '_GNU_SOURCE' macro redefined [-Wmacro-redefined]
^
<stdin>:1:9: note: previous definition is here
^
1 warning generated.
```
This happened when compiling python [2] with a stale homebrew util.h file from
libevent (which admittedly would not happen in a correct libevent install, as the
header should be installed under /usr/local/include/event2/util.h). However, if
both headers had been combined (which is more likely), it would have failed as
shown above.
Removing the ad hoc definition unbreaks compiling python's pyconfig.h.in header
when included after util.h from libevent.
1. http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html
2. https://github.com/python/cpython/blob/master/configure.ac#L126
Closes: #773 (cherry-picked)
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
|
| |
| |
| |
| |
| |
| |
| | |
windows has intptr_t instead of regular int.
Also tt_fd_op() had been introduced, since we cannot use tt_int_op() for
comparing fd, since it is not always int.
|
| |
| |
| |
| |
| |
| | |
In 755fbf16c ("Add void* arguments to request_new and reply_new
evrpc hooks") this new functions had been introduced, but newer used,
what for? So let's use them.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
And use it in places where event_debug() should be called (since it
requires access to "event_debug_logging_mask_" and in win32 it is
tricky).
One of this places that is covered by this patch is the test for
event_debug().
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
MinGW 32-bit 5.3.0 does not defines it and our appveyour [1] build
reports this instantly:
evutil.c: In function 'evutil_make_listen_socket_ipv6only':
evutil.c:392:40: error: 'IPV6_V6ONLY' undeclared (first use in this function)
return setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (void*) &one,
[1]: https://www.appveyor.com/docs/windows-images-software/#mingw-msys-cygwin
Another solution will be to use mingw64 which has it, but I guess we do
want that #ifdef anyway.
|
| |
| |
| |
| |
| |
| |
| |
| | |
And a set of flags:
- EVHTTP_URI_QUERY_LAST
- EVHTTP_URI_QUERY_NONCONFORMANT
Fixes: #15
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
According to RFC3493 and most Linux distributions, default value is to
work in IPv4-mapped mode. If there is a requirement to bind same port
on same ip addresses but different handlers for both IPv4 and IPv6,
it is required to set IPV6_V6ONLY socket option to be sure that the
code works as expected without affected by bindv6only sysctl setting
in system.
See an example working with this patch:
https://gist.github.com/demirten/023008a63cd966e48b0ebcf9af7fc113
Closes: #640 (cherry-pick)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Some implementations of bufferevents (for example openssl) can overrun
read high watermark.
And after this if user callback will not drain enough data it will be
suspended (i.e. it will not be runned again anymore).
This is not the expecting behaviour as one may guess, since in this case
the data will never be read. Hence once we detected that the watermark
exceeded (even after calling user callback) we will schedule the
callback again.
This also can be fixed in bufferevent openssl implementation (by
strictly limiting how much data is added to the read buffer according to
read high watermark), but since this data is already available (and in
memory) there is no point in doing so.
|
| |
| |
| |
| | |
Closes: #658
|
| |
| |
| |
| |
| | |
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Closes: #647 (picked)
|
| |
| |
| |
| | |
Fixes: #633
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The sizeof `struct event` can reduced on both 32 bit and 64 bit systems
by moving the 4 bytes that make up `ev_events` and `ev_res` below `ev_fd`,
before `struct event_base * ev_base;` since our compiler wouldn't dare do
such a thing (it instead will pad twice, whereas it only needs to be padded
once)
```C
struct event {
/* OFFS | SZ Bytes | Total Bytes | START - END */
struct event_callback ev_evcallback; /* 0x0 | 40 | 40 | 0x0 - 0x28 */
union { /* 0x28 | ----------- | ----------- | ------------ */
TAILQ_ENTRY(event) ev_next_with_common_timeout; /* | ((16)) | | */
int min_heap_idx; /* | ((04)) | | */
} ev_timeout_pos; /* | 16 | 56 | 0x28 - 0x38 */
int ev_fd; /* 0x38 | 04 | 60 | 0x38 - 0x3c */
```
Since the next field is 8 bytes in length, and we are up to 60 bytes, `ev_fd` ends up being padded (4 more bytes on 64b).
```C
/* --- 1 byte gap HERE ---> 1 | <61> */
/* --- 1 byte gap HERE ---> 1 | <62> */
/* --- 1 byte gap HERE ---> 1 | <63> */
/* --- 1 byte gap HERE ---> 1 | <64> */
struct event_base * ev_base; /* 0x3c | 8 | 68 | 0x3c - 0x40 */
union { /* 0x40 | ------------ | ---------- | ------------ */
struct { /* | ------------ | | */
LIST_ENTRY (event) ev_io_next; /* | ((16+ | | */
struct timeval ev_timeout; /* | 16)) | | */
} ev_io; /* | ((32)) | | */
struct { /* | ------------ | | */
LIST_ENTRY (event) ev_signal_next; /* | ((16+ | | */
short ev_ncalls; /* | 02+ | | */
short * ev_pncalls; /* | 08)) | | */
} ev_signal; /* | ((26)) | | */
} ev_; /* 0x60 | 32 | 100 | 0x40 - 0x60 */
short ev_events; /* 0x60 | 2 | 102 | 0x60 - 0x62 */
short ev_res; /* 0x62 | 2 | 104 | 0x62 - 0x64 */
```
We now hit another line, `struct timeval` is 16 bytes on 64b arch, so we have 4 more bytes
of padding on `ev_res`.
```C
/* --- 1 byte gap HERE --- */
/* --- 1 byte gap HERE --- */
/* --- 1 byte gap HERE --- */
/* --- 1 byte gap HERE --- */
struct timeval ev_timeout; /* 0x64 | 16 | 120 | 0x64 - 0x74 */
};
```
After moving `ev_events` and `ev_res` below `ev_fd` we have something
a bit more optimal:
```C
struct event2 {
/* OFFS | SZ / Bytes | RSUM Bytes | START - END */
struct event_callback ev_evcallback; /* 0x0 | 40 | 40 | 0x0 - 0x28 */
union { /* 0x28 | ------------ | ---------- | ------------ */
TAILQ_ENTRY(event) ev_next_with_common_timeout; /* | ((16)) | | */
int min_heap_idx; /* | ((04)) | | */
} ev_timeout_pos; /* | 16 | 56 | 0x28 - 0x38 */
int ev_fd; /* 0x38 | 4 | 60 | 0x38 - 0x3c */
short ev_events; /* 0x3c | 2 | 62 | 0x3c - 0x3e */
short ev_res; /* 0x3e | 2 | 64 | 0x3e - 0x40 */
struct event_base * ev_base; /* 0x40 | 8 | 74 | 0x40 - 0x48 */
union { /* 0x48 | ------------ | ---------- | ------------ */
struct { /* | ------------ | | */
LIST_ENTRY (event) ev_io_next; /* | ((16+ | | */
struct timeval ev_timeout; /* | 16)) | | */
} ev_io; /* | ((32)) | | */
struct { /* | ------------ | | */
LIST_ENTRY (event) ev_signal_next; /* | ((16+ | | */
short ev_ncalls; /* | 02+ | | */
short * ev_pncalls; /* | 08)) | | */
} ev_signal; /* | ((26)) | | */
} ev_; /* | 32 | 106 | 0x48 - 0x68 */
struct timeval ev_timeout; /* 0x68 | 16 | 120 | 0x68 - 0x78 */
};
```
We still have a gap here, but the first was removed.
Again, we can save 8 bytes on both 32 and 64 word sizes (32/64 byte cacheline).
Below are the results for testing v2.1.6 -> master -> master + this patch (Release/-O3)
Code:
```C
#include <event2/event.h>
int
main(int argc, char ** argv) {
printf("%zu\n", event_get_struct_event_size());
return 0;
}
```
Branch: `master` (2.2.x)
```
$ gcc -O3 -Wall -Wl,-R/usr/local/lib bleh.c -L/usr/local/lib -o bleh -levent
$ ldd bleh
linux-vdso.so.1 => (0x00007ffc3df50000)
libevent.so.2.2.0 => /usr/local/lib/libevent.so.2.2.0 (0x00007f91fd781000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f91fd3a1000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f91fd182000)
/lib64/ld-linux-x86-64.so.2 (0x00007f91fdbcc000)
$ ./bleh
128
```
Release: `2.1.6`
```
$ gcc -O3 bleh.c -o bleh -levent
$ ldd bleh
linux-vdso.so.1 => (0x00007ffd43773000)
libevent-2.1.so.6 => /usr/lib/x86_64-linux-gnu/libevent-2.1.so.6 (0x00007feb3add6000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007feb3a9f6000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007feb3a7d7000)
/lib64/ld-linux-x86-64.so.2 (0x00007feb3b22a000)
$ ./bleh
128
```
Branch: `this one`
```
$ gcc -O3 -Wl,-R./lib bleh.c -o bleh -L./lib -levent
$ ldd bleh
linux-vdso.so.1 => (0x00007ffff55f7000)
libevent.so.2.2.0 => ./lib/libevent.so.2.2.0 (0x00007ff8e5c82000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff8e58a2000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff8e5683000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff8e60cd000)
$ ./bleh
120
```
|
| | |
|
|/
|
|
| |
non-windows machines
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
connections.
This is important, as otherwise clients can easily exhaust the file
descriptors available on a libevent HTTP server, which can cause
problems in other code which does not handle EMFILE well: for example,
see https://github.com/bitcoin/bitcoin/issues/11368
Closes: #578 (patch cherry picked)
|
|
|
|
|
| |
Replaces reference in the http.h include header file to evhttp_get_decoded_uri
with evhttp_uridecode. There is no function called evhttp_get_decoded_uri.
|
|
|
|
| |
somehow missing from 043ae7481f4a73b0f48055a0260afa454f02d136
|
|\
| |
| |
| |
| |
| | |
* official/pr/527:
Fix a few trivial documentation typos
Clarify event_free() documentation regarding pending/active events
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
Currently it's not clear as to whether "first make it non-pending and
non-active" sentence requires user to take some action (e.g. call event_del(),
which event_free() already does internally) or just describes what this
function does from the developer point of view.
|
| |
| |
| |
| | |
Closes: #525
|
| | |
|
|/
|
|
|
|
| |
Refs: #511
Fixes: 7182c2f561570cd9ceb704623ebe9ae3608c7b43 ("cmake: build SHARED and
STATIC libraries (like autoconf does)")
|
|
|
|
|
|
|
|
| |
But this is kind of hot-fix, we definitelly need more sane arc4random
compat layer.
Fixes: #488
Introduced-in: 6541168 ("Detect arch4random_addrandom() existence")
|
|
|
|
| |
==> win: C:\vagrant\log.c(73): error C2370: 'event_debug_logging_mask_' : redefinition; different storage class [C:\vagrant\.cmake-vagrant\event_core_shared.vcxproj]
|
|
|
|
|
| |
Before 7182c2f561570cd9ceb704623ebe9ae3608c7b43 ("cmake: build SHARED
and STATIC libraries (like autoconf does)") it links with *.c.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since they are useful for debugging, and if autotools build them then
cmamke has to do this too, to make migration more simple.
And now:
- tests: uses shared libraries (since this is upstreams one)
- other binaries: uses static libraries
This removes next private config:
- EVENT__NEED_DLLIMPORT
|
|
|
|
|
|
|
|
|
|
|
|
| |
This will remove openssl requirement if you don't use it (i.e. if you
not link with openssl_pthreads).
Plus it fixes some linking dependencies:
- libm required only for test-ratelim
And fix some coding style alignment issues.
Refs: #246
|
|
|
|
| |
Fixes: #442
|
|
|
|
|
| |
Refs: #370
Refs: #475
|