fanquake [Tue, 15 Jun 2021 05:35:58 +0000 (13:35 +0800)]
build: remove call to AC_PREFIX_DEFAULT
> By default, configure sets the prefix for files it installs to /usr/local.
A call to AC_PREFIX_DEFAULT, just to set the value the same as the
default, would seem unnecessary. Note that the "initialize prefix"
comment dates back to aa6567fe6475d3230c7c745a7ca208735af0c331, prior to
when an autoconf macro was actually being used.
Azat Khuzhin [Tue, 23 Mar 2021 06:50:03 +0000 (09:50 +0300)]
Switch to lukka/run-vcpkg@v7 and update vcpkgGitCommitId
Let's see if it uses set-env or not [1]:
Run lukka/run-vcpkg@v2
Restore vcpkg and its artifacts from cache
Set output env vars
Error: Unable to process command '::set-env name=RUNVCPKG_VCPKG_ROOT::D:\a\libevent\vcpkg' successfully.
Error: The `set-env` command is disabled. Please upgrade to using Environment Files or opt into unsecure command execution by setting the `ACTIONS_ALLOW_UNSECURE_COMMANDS` environment variable to `true`. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
error: could not open file /var/cache/pacman/pkg/libzstd-1.5.0-1-x86_64.pkg.tar.zst: Child process exited with status 127
error: could not open file /var/cache/pacman/pkg/zstd-1.5.0-1-x86_64.pkg.tar.zst: Child process exited with status 127
error: could not open file /var/cache/pacman/pkg/pacman-5.2.2-23-x86_64.pkg.tar.zst: Child process exited with status 127
error: failed to commit transaction (cannot open package file)
Azat Khuzhin [Tue, 27 Apr 2021 18:15:03 +0000 (21:15 +0300)]
Do not wrap lines in AC_CHECK_HEADERS/AC_CHECK_FUNCS (fixes detection in mingw)
Fixes: d433f847 ("Revert "build: use literals for AC_CHECK_HEADERS/AC_CHECK_FUNCS"") Fixes: 28f0fe6f ("build: use literals for AC_CHECK_HEADERS/AC_CHECK_FUNCS") Fixes: ce028cef ("build: fix autotools build under mingw")
Mike Sharov [Sun, 25 Apr 2021 13:12:29 +0000 (09:12 -0400)]
Retry write on EINTR in signal handler
The signal handler writes the received signal number as a byte value
into the notification pipe. If two signals are received in quick
succession, one of the writes may fail with EINTR without writing the
byte. This commit will check for EINTR and retry the write. If the error
is other than EINTR, a warning will be logged.
Note, that:
- on systems with sigaction libevent uses sigaction with SA_RESTART
- on linux writing to pipe is restartable and firstly it will try to
write that byte so linux should not be affected in any form [1].
Emil Engler [Fri, 2 Apr 2021 19:02:12 +0000 (21:02 +0200)]
sample: use unsigned short instead of int for port
The C standard gurantees that an unsigned short is at least up to 65535
huge. Enough to store every TCP port. Also the parameter PORT is
overgiven to the `htons()` function which assumes that the parameter is
of type `uint16_t` which unsigned short is on most platforms.
Azat Khuzhin [Sun, 28 Mar 2021 14:16:54 +0000 (17:16 +0300)]
build: use literals for AC_CHECK_HEADERS/AC_CHECK_FUNCS
autoconf 2.72 reports:
configure.ac:188: warning: AC_CHECK_HEADERS(\
): you should use literals
../autoconf-2.71/lib/autoconf/headers.m4:217: AC_CHECK_HEADERS is expanded from...
configure.ac:188: the top level
configure.ac:188: warning: AC_CHECK_HEADERS(afunix.h
): you should use literals
And also it fails to find fcntl.h and other headers because of this:
configure:14725: checking for fcntl.h
configure:14725: gcc -c -I/mingw64/include conftest.c >&5
conftest.c:77:10: fatal error: fcntl.h: No such file or directory
77 | #include < fcntl.h>
Azat Khuzhin [Sun, 28 Mar 2021 06:01:58 +0000 (09:01 +0300)]
build: fix autotools build under mingw
autotools that is shipped with mingw (autoconf 2.71-1, automake
1.6-1.16, automake wrapper 11-1), does not allow trailing backslashes
for AC_CHECK_HEADERS() and AC_CHECK_FUNCS(), otherwise it generates
incorrect for loop, and reports:
../configure: line 14724: syntax error near unexpected token `as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh`'
../configure: line 14724: ` as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh`'
Error: Process completed with exit code 1.
Here is a simple analog:
for VAR in <CR> foo \ <CR> bar \
do :
echo $VAR
done
fanquake [Sun, 28 Mar 2021 02:57:11 +0000 (10:57 +0800)]
build: remove splice implementation fragments
Looks like a `splice` implementation was planned, but has clearly never
eventuated (the TODO comment is from ~12 years ago, in 8b5bd77415fb6634fadf08357676926fecf5f032). For now, it's probably better
to remove the unused code/correct the docs.
Azat Khuzhin [Tue, 23 Mar 2021 06:40:30 +0000 (09:40 +0300)]
ci: fix upload-artifacts for linux dist build
Fixes [1]:
Run actions/upload-artifact@v1
Error: Path does not exist /home/runner/work/libevent/libevent/build
Error: Exit code 1 returned from process: file name '/home/runner/runners/2.277.1/bin/Runner.PluginHost', arguments 'action "GitHub.Runner.Plugins.Artifact.PublishArtifact, Runner.Plugins"'.
Azat Khuzhin [Tue, 23 Mar 2021 06:10:00 +0000 (09:10 +0300)]
Merge branch 'http-fix-fd-leak'
* http-fix-fd-leak:
http: fix fd leak on fd reset (by using bufferevent_replacefd())
bufferevent: introduce bufferevent_replacefd() (like setfd() but also close fd)
fanquake [Tue, 23 Mar 2021 01:52:14 +0000 (09:52 +0800)]
build: use AC_CHECK_LIB over AC_HAVE_LIBRARY
AC_HAVE_LIBRARY is deprecated, see
https://www.gnu.org/software/autoconf/manual/autoconf-2.70/html_node/Obsolete-Macros.html,
and has been prior to Autoconf 2.67, which is the minimum required by
the project. It's usage also causes warnings with newer versions of autoconf:
```bash
configure.ac:319: warning: The macro `AC_HAVE_LIBRARY' is obsolete.
configure.ac:319: You should run autoupdate.
```
`AC_HAVE_LIBRARY` was introduced in #969, although it's not clear why it
was decided to revert to using an obselete macro.
I recently found that when the network status changed when calling
bufferevent_socket_connect_hostname (e.g. switching between several
WIFIs), all DNS servers would fail, and the timeout of probe would be
very long if there were many DNS requests. I want libevent to support
manual setting of MAX_PROBE_TIMEOUT and TIMEOUT_BACKOFF_FACTOR
So move hardcoded MAX_PROBE_TIMEOUT and TIMEOUT_BACKOFF_FACTOR into
struct, and allow changing them.
Loïc Yhuel [Mon, 23 Nov 2020 16:24:36 +0000 (17:24 +0100)]
cmake: do not link libevent with libevent_core
When add_event_library macro was called without the INNER_LIBRARIES parameter, it reused the
value set by a previous call, since the INNER_LIBRARIES variable was not reset.
Azat Khuzhin [Mon, 2 Nov 2020 07:01:41 +0000 (10:01 +0300)]
Merge branch 'macos-brew-openssl-v2'
By Azat Khuzhin (2) and fanquake (1)
* macos-brew-openssl-v2:
Add autodetection of openssl via brew into build matrix
cmake: find openssl prefix via brew
autotools: attempt to find OpenSSL via homebrew on macOS
autotools: attempt to find OpenSSL via homebrew on macOS
When compiling for macOS, where users will likely have OpenSSL installed
via brew, rather than available on the system, use brew --prefix to
figure out where OpenSSL is, and then augment the pkg-config path so
that libs are found.
Azat Khuzhin [Sat, 31 Oct 2020 19:48:37 +0000 (22:48 +0300)]
Fix BEV_IS_SSL() macro
We cannot use the same trick with external declaration,
since there are copy of bufferevent_ops_ssl in each library:
- openssl
- mbedlts
However we can just compare the name of the bufferevent type for now.
(It is totally fine to use memcmp() here since it will be optimized by the compiler).
Azat Khuzhin [Tue, 3 Sep 2019 21:56:20 +0000 (00:56 +0300)]
http: eliminate redundant bev fd manipulating and caching [WIP]
At the very beginning we reset the bufferevent fd (if bev has it), which
is not a good idea, since if user passes bufferevent with existing fd he
has some intention.
So we need to:
- use BEV_OPT_CLOSE_ON_FREE for default bufferevent_socket_new() (to
avoid manual shutdown/closee)
- drop getsockopt(SOL_SOCKET, SO_ERROR), since bufferevent already has
evutil_socket_finished_connecting_()
- drop supperior bufferevent_setfd(bev, -1) in
evhttp_connection_connect_()
Azat Khuzhin [Sun, 4 Oct 2020 19:56:30 +0000 (22:56 +0300)]
Change prefix for man pages from "le_" to "libevent_"
As pointed by @kloczek:
"With only two characters it would be harder to guess under what kind of name are libevent lvl 3 man pages.
Longer name with bash/fix/zsh tab competition should not be a problem :)"
Azat Khuzhin [Wed, 16 Sep 2020 05:10:11 +0000 (08:10 +0300)]
Generate only real man pages with doxygen (MAN_LINKS=NO)
WIth MAN_LINKS=YES doxygen will generate ton's of man pages for each
field, function and so on, but it will not contain anything useful
except for link to another man page (header).
So to avoid man pages clashing, disable MAN_LINKS, and this will
generate man pages only for explicitly documented parts.
But even after this we have pretty non-unique man pages names:
Azat Khuzhin [Wed, 16 Sep 2020 05:25:20 +0000 (08:25 +0300)]
Remove man pages from repo (they can be generated via doxygen)
The problem with this man pages are:
- they are likely outdated
- they don't have install target
- and besides quality of man pages generated by doxygen not worse
Azat Khuzhin [Fri, 28 Aug 2020 22:15:20 +0000 (01:15 +0300)]
test/regress_dns: fix -Wmaybe-uninitialized
Was not noticed since it is reported only with optimization enabled, as
stated in gcc(1):
The effectiveness of some warnings depends on optimizations also
being enabled. For example -Wsuggest-final-types is more effective with
link-time optimization and -Wmaybe-uninitialized does not warn at all
unless optimization is enabled.
And interesting thing is that it is reported only for -O2, not for -O3,
that's why I did not catched it in both cmake env that I had:
- debug (it has -O0)
- release (it has -O3)
Azat Khuzhin [Thu, 6 Aug 2020 07:12:07 +0000 (10:12 +0300)]
Merge #1074
yuangongji:
"Fix CI failures #1071
- Install vcpkg through the source code to temporarily solve the windows CI problem.
- Update cache version and replace setup-msys2."
* upstream/pr/1074:
fix CI:Update cache version and replace setup-msys2
fix CI: Install vcpkg through the source code to temporarily solve the windows CI problem
GetTempFileNameA() takes an optional prefix, and a "unique" long value
which can optionally be zero, which causes it to automatically
increment until a not-yet-existing filename is found.
When libevent creates many AF_UNIX socketpairs on windows,
it slows down dramatically, due to always using the same blank prefix,
and GetTempFileNameA() needing to iterate through all the existing
socketpair filenames. With a present and varying prefix, it will have
much less need to iterate.
It was also possible for a race with other processes also using
blank-prefix tmpfile names to result in both trying to start using
the same name at the same time (because libevent deletes the file
and then re-creates it as a unix socket), which should now be
much less likely.
Unfortuantely, "much" is just a factor of 32k, because the prefix
is only 3 characters, and windows filesystems are case-insensitive,
so doing better would require more sophisticated windows API usage
and charset trickyness.
Left:
- regress_http https_mbedtls support
- ChangeLog entry
* mbedtls:
test: rename ssl/* -> openssl/*
Join le_ssl_ops.post_init with le_ssl_ops.init
Update LICENSE for ssl-client-mbedtls.c
Merge ssl implementations (openssl and mbedtls)
add mbedtls to CI
fix build system and add test and cleanup code
mbed TLS cmake support
simple https client example using mbedtls
mbedtls based SSL implementation