]> granicus.if.org Git - libevent/log
libevent
4 years agoDon't override `file` built-in
Enji Cooper [Fri, 27 Mar 2020 00:21:25 +0000 (17:21 -0700)]
Don't override `file` built-in

Use `filep` instead of `file` to clarify the fact that `file` is a file
pointer object.

This mutes warnings on python 2.7 with `pylint`.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoResolve variable name issues per PEP8
Enji Cooper [Fri, 27 Mar 2020 00:13:14 +0000 (17:13 -0700)]
Resolve variable name issues per PEP8

Move all logic under `if __name__ == "__main__"` to a `main(..)`
function.

The purpose of this is to not only address flake8/pylint reported issues
with variable names, but also to enable testing of the function in
isolation to ensure the logic acts as desired.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoSort imports per PEP8
Enji Cooper [Thu, 26 Mar 2020 23:07:17 +0000 (16:07 -0700)]
Sort imports per PEP8

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoMute clang 8 compilation error with gcc pragma
Enji Cooper [Fri, 27 Mar 2020 01:28:07 +0000 (18:28 -0700)]
Mute clang 8 compilation error with gcc pragma

Move the pragma ignoring outside the function to fix the build with gcc.
While here, add equivalent clang pragmas to mute the warning, as well.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
4 years agoMerge #976 -- symbols check build fixes
Azat Khuzhin [Sun, 22 Mar 2020 16:36:45 +0000 (19:36 +0300)]
Merge #976 -- symbols check build fixes

* upstream/pr/976:
  github workflows: ignore previous cache
  github workflows: test for mingw via cmake
  cmake: replace CheckFunctionExists with CheckSymbolExists

4 years agogithub workflows: ignore previous cache
yuangongji [Sun, 22 Mar 2020 10:35:24 +0000 (18:35 +0800)]
github workflows: ignore previous cache

modify the cache key to ignore previous cache
for the changes of configure.ac/CMakeLists.txt
to take effect.

4 years agogithub workflows: test for mingw via cmake
yuangongji [Sun, 22 Mar 2020 05:51:46 +0000 (13:51 +0800)]
github workflows: test for mingw via cmake

4 years agocmake: replace CheckFunctionExists with CheckSymbolExists
yuangongji [Fri, 20 Mar 2020 09:49:37 +0000 (17:49 +0800)]
cmake: replace CheckFunctionExists with CheckSymbolExists

Checking functions with `CheckFunctionExists` may
get wrong results, we should replace it with
`CheckSymbolExists`, which is recommended by the cmake
official documentation.
Before using `CheckSymbolExists`, we use
`CheckIncludeFiles` to check header files and save the
available header files in a variable that guarantees
`CheckSymbolExists` and `CheckTypeSize` to work correctly.
This approach is modeled after the cmake scripts of `curl`.

The following functions or files were not found before
modification, they can now be found:
- msys2 + mingw-8.1.0 on Windows10 or mingw-7.3.0 on Ubuntu-18.04
timerclear
timercmp
timerisset

- windows10
getaddrinfo
getnameinfo
getprotobynumber
getservbyname
putenv
strtoll
timerclear
timercmp
timerisset

- ubuntu-18.04
sys/sysctl.h
timeradd
timerclear
timercmp
timerisset

- MacOS 10.13
sys/random.h
timeradd
timerclear
timercmp
timerisset

4 years agoLibeventConfig.cmake: restore CMAKE_FIND_LIBRARY_SUFFIXES and LIBEVENT_STATIC_LINK...
Mario Emmenlauer [Tue, 3 Mar 2020 18:02:24 +0000 (19:02 +0100)]
LibeventConfig.cmake: restore CMAKE_FIND_LIBRARY_SUFFIXES and LIBEVENT_STATIC_LINK default

The current cmake/LibeventConfig.cmake.in has a few problems and I'm not
sure how cleanly developed it is. It seems rater complex for the little
things I would assume it needs to do.

I found two problems that are fixed in this PR:

- If the downstream user does not explicitly set LIBEVENT_STATIC_LINK
  before calling find_package(libevent) then they will not be able to
  detect the static library, even if its the only one that exists. Since
  this may be rather strict, I've changed the behavior so that
  LIBEVENT_STATIC_LINK can be set to ON or OFF, but if unset, it defaults
  to whatever configuration libevent was built as.

- The other problem is a bug. The package configuration needs to unset
  CMAKE_FIND_LIBRARY_SUFFIXES after use, otherwise all packages that are
  detected after libevent will be "infected" by this setting. This was a
  significant problem for us, and is very hard to detect in downstream
  project, because the order of dependencies will lead to different search
  results.

4 years agoMerge branch 'build-fixes' (#969)
Azat Khuzhin [Tue, 17 Mar 2020 18:45:04 +0000 (21:45 +0300)]
Merge branch 'build-fixes' (#969)

* build-fixes:
  github workflow: fix configure error on mingw-w64
  cmake: fix getaddrinfo checking error
  cmake: remove CheckFunctionExistsEx
  autoconf: fix getaddrinfo checking errors on mingw

4 years agogithub workflow: fix configure error on mingw-w64
yuangongji [Tue, 17 Mar 2020 11:57:10 +0000 (19:57 +0800)]
github workflow: fix configure error on mingw-w64

4 years agocmake: fix getaddrinfo checking error
yuangongji [Mon, 16 Mar 2020 12:11:06 +0000 (20:11 +0800)]
cmake: fix getaddrinfo checking error

Using `CheckFunctionExists` on Windows to check `getaddrinfo`
will get `not found`, but it actually exists. Using `CheckSymbolExists`
with headers will get correct results. Other functions such as
`getnameinfo`,`inet_ntop`,etc. have the same issue.

4 years agocmake: remove CheckFunctionExistsEx
yuangongji [Mon, 16 Mar 2020 10:57:54 +0000 (18:57 +0800)]
cmake: remove CheckFunctionExistsEx

`CheckFunctionExistsEx` is copied from the cmake modules before
3.1.2, which is the minimum required version of libevent.
The internal module `CheckFunctionExists`of cmake can completely
replace it.

4 years agoautoconf: fix getaddrinfo checking errors on mingw
yuangongji [Sat, 14 Mar 2020 03:13:38 +0000 (11:13 +0800)]
autoconf: fix getaddrinfo checking errors on mingw

`AC_CHECK_FUNCS` can not properly check `getaddrinfo` because this
function requires some special headers on mingw.
Using `AC_CHECK_DECL` can effectively solve this issue.

Same for
- getnameinfo
- getprotobynumber
- getservbyname
- inet_ntop
- inet_pton

4 years agoAdd EVENT_BASE_FLAG_EPOLL_DISALLOW_TIMERFD flag (fixes: #958)
Azat Khuzhin [Sun, 1 Mar 2020 13:01:12 +0000 (16:01 +0300)]
Add EVENT_BASE_FLAG_EPOLL_DISALLOW_TIMERFD flag (fixes: #958)

By default we are using CLOCK_MONOTONIC_COARSE, but if
EVENT_BASE_FLAG_PRECISE_TIMER isset, then CLOCK_MONOTONIC will be used,
however this will also enable timerfd, while this is not always what
someone wants, hence add a flag to control this (by default the old
behavior is preserved, set new flag to change it).

4 years agotest-time: do not use deprecated API
Azat Khuzhin [Sun, 1 Mar 2020 12:47:40 +0000 (15:47 +0300)]
test-time: do not use deprecated API

- event_init() -> event_base_new()
- event_set() -> event_new()
- check return value of event_base_dispatch()
- use EXIT_SUCCESS/EXIT_FAILURE

4 years agotest-time: enable debug mode if EVENT_DEBUG_LOGGING_ALL env set
Azat Khuzhin [Sun, 1 Mar 2020 11:54:36 +0000 (14:54 +0300)]
test-time: enable debug mode if EVENT_DEBUG_LOGGING_ALL env set

4 years agoFix typo in thread.h (s/event/evthread)
Azat Khuzhin [Sun, 1 Mar 2020 10:52:32 +0000 (13:52 +0300)]
Fix typo in thread.h (s/event/evthread)

4 years agoincrease segment refcnt only if evbuffer_add_file_segment() succeeds
yuangongji [Sat, 29 Feb 2020 09:47:47 +0000 (17:47 +0800)]
increase segment refcnt only if evbuffer_add_file_segment() succeeds

4 years agoevdns: fix a crash when evdns_base with waiting requests is freed
ayuseleznev [Thu, 27 Feb 2020 13:59:45 +0000 (16:59 +0300)]
evdns: fix a crash when evdns_base with waiting requests is freed

Fix undefined behaviour and application crash that might take
place in some rare cases after calling evdns_base_free when
there are requests in the waiting queue.

Current cleanup procedure in evdns_base_free_and_unlock
function includes 2 steps:
1. Finish all inflight requests.
2. Finish all waiting requests.
During the first step we iterate over each list in req_heads
structure and finish all requests in these lists. With current
logic finishing an inflight request (function request_finished)
removes it from the inflight requests container and forces
a wating connection to be sent (by calling
evdns_requests_pump_waiting_queue). When these new requests are
sent it is possible that they will be inserted to the list in
req_heads that we've already cleaned.
So in some cases container of the inflight requests is not empty
after this procedure and some requests are not finished and
deleted. When timeouts for these requests expire
evdns_request_timeout_callback is called but corresponding
evdns_base has been already deleted which causes undefined
behaviour and possible applicaton crash.

It is interesting to note that in old versions of libevent such
situation was not possible. This bug was introduced by the commit
14f84bbdc77d90b1d936076661443cdbf516c593. Before this commit
nameservers were deleted before finishing the requests. Therefore
it was not possible that requests from the waiting queue be sent
while we finish the inflight requests.

4 years agoevent_base_once: fix potential null pointer threat
chenguolong [Tue, 4 Feb 2020 08:05:02 +0000 (16:05 +0800)]
event_base_once: fix potential null pointer threat

supposing if base is null, EVBASE_ACQUIRE_LOCK and EVBASE_RELEASE_LOCK
would get a coredump, so we add a guard for protection.

Signed-off-by: chenguolong <cgl.chenguolong@huawei.com>
4 years agotest-ratelim: add missing free
yuangongji [Tue, 11 Feb 2020 06:33:15 +0000 (14:33 +0800)]
test-ratelim: add missing free

4 years agomisspelling of output in bufferevent_struct.h
yangyongsheng [Tue, 28 Jan 2020 06:31:39 +0000 (14:31 +0800)]
misspelling of output in bufferevent_struct.h

4 years agoMerge branch 'github-actions-v2' (#951)
Azat Khuzhin [Sun, 26 Jan 2020 22:56:58 +0000 (01:56 +0300)]
Merge branch 'github-actions-v2' (#951)

* github-actions-v2:
  travis: disable doxygen and coveralls, in favor of github actions
  github actions: test and coverage
  github actions: doxygen
  Ignore truthy in yamllint (for github-actions)
  test: mark common_timeout as retriable
  cmake: set rpath for libraries on linux
  test-export: compatible with all versions of visual studio
  coverage: 'lcov --remove' need full path

4 years agotravis: disable doxygen and coveralls, in favor of github actions
Azat Khuzhin [Sun, 26 Jan 2020 22:53:27 +0000 (01:53 +0300)]
travis: disable doxygen and coveralls, in favor of github actions

4 years agogithub actions: test and coverage
yuangongji [Tue, 21 Jan 2020 11:51:48 +0000 (19:51 +0800)]
github actions: test and coverage

4 years agogithub actions: doxygen
yuangongji [Tue, 21 Jan 2020 02:14:11 +0000 (10:14 +0800)]
github actions: doxygen

4 years agoIgnore truthy in yamllint (for github-actions)
Azat Khuzhin [Sun, 26 Jan 2020 18:30:15 +0000 (21:30 +0300)]
Ignore truthy in yamllint (for github-actions)

4 years agotest: mark common_timeout as retriable
Azat Khuzhin [Thu, 23 Jan 2020 18:34:18 +0000 (21:34 +0300)]
test: mark common_timeout as retriable

Refs: https://github.com/libevent/libevent/pull/951#issuecomment-576711224

4 years agocmake: set rpath for libraries on linux
yuangongji [Mon, 20 Jan 2020 13:17:27 +0000 (21:17 +0800)]
cmake: set rpath for libraries on linux

4 years agotest-export: compatible with all versions of visual studio
yuangongji [Mon, 20 Jan 2020 13:15:26 +0000 (21:15 +0800)]
test-export: compatible with all versions of visual studio

4 years agocoverage: 'lcov --remove' need full path
yuangongji [Tue, 14 Jan 2020 07:54:14 +0000 (15:54 +0800)]
coverage: 'lcov --remove' need full path

4 years agoDo not use shared global structures on CYGWIN
Azat Khuzhin [Tue, 21 Jan 2020 17:10:15 +0000 (20:10 +0300)]
Do not use shared global structures on CYGWIN

Fixes: #950
4 years agoAdd vcpkg installation instructions
JackBoosY [Wed, 22 Jan 2020 06:02:34 +0000 (22:02 -0800)]
Add vcpkg installation instructions

4 years agotest: move thread into realtime class even on EVENT__DISABLE_THREAD_SUPPORT
Azat Khuzhin [Tue, 14 Jan 2020 18:45:01 +0000 (21:45 +0300)]
test: move thread into realtime class even on EVENT__DISABLE_THREAD_SUPPORT

4 years agotest: fix compilation without thread support (EVENT__DISABLE_THREAD_SUPPORT=ON)
Azat Khuzhin [Tue, 14 Jan 2020 07:20:12 +0000 (10:20 +0300)]
test: fix compilation without thread support (EVENT__DISABLE_THREAD_SUPPORT=ON)

4 years agotravis-ci: do not allow failures under osx
Azat Khuzhin [Mon, 13 Jan 2020 23:36:54 +0000 (02:36 +0300)]
travis-ci: do not allow failures under osx

4 years agotest: fix bufferevent/bufferevent_connect_fail_eventcb* under osx/freebsd
Azat Khuzhin [Mon, 13 Jan 2020 23:14:16 +0000 (02:14 +0300)]
test: fix bufferevent/bufferevent_connect_fail_eventcb* under osx/freebsd

For OSX the socket should be closed, otherwise the "connection refused"
will not be triggered.

And freebsd can return error from the connect().

4 years agotest: fix dst thread in move_pthread_to_realtime_scheduling_class (osx)
Azat Khuzhin [Mon, 13 Jan 2020 21:38:06 +0000 (00:38 +0300)]
test: fix dst thread in move_pthread_to_realtime_scheduling_class (osx)

Fixes the following tests on osx:
- del_wait
- no_events

Refs: #940

4 years agotest: fix compilation under win32 (rearrange thread_setup() code)
Azat Khuzhin [Mon, 13 Jan 2020 21:27:21 +0000 (00:27 +0300)]
test: fix compilation under win32 (rearrange thread_setup() code)

4 years agotest: use THREAD_* wrappers over pthread* in del_notify
Azat Khuzhin [Mon, 13 Jan 2020 21:41:48 +0000 (00:41 +0300)]
test: use THREAD_* wrappers over pthread* in del_notify

4 years agoMerge branch 'osx-clock'
Azat Khuzhin [Mon, 13 Jan 2020 20:36:40 +0000 (23:36 +0300)]
Merge branch 'osx-clock'

Moves the thread into real-time scheduling class, as recommended in [1], it
fixes the separate test provided by @ygj6 [2] everywhere (github actions,
travis-ci, appveyor) under osx.

  [1]: https://developer.apple.com/library/archive/technotes/tn2169/_index.html
  [2]: https://github.com/azat-archive/osx-timers/commit/dde1a6e4d04506d0e0fb193ebb9f49ae25873be6

Although even after this changes the following time-related tests failed
on travis-ci:
- no_events
- del_wait

But anyway I guess #940 can be closed, since this fixes the issue in common.

* osx-clock:
  test: Use THREAD_* wrappers in del_notify/del_wait
  test: move threads created with THREAD_START() to realtime scheduling class too
  test: put thread into real time scheduling class on osx for better latencies

Closes: #940
4 years agotest: Use THREAD_* wrappers in del_notify/del_wait
Azat Khuzhin [Mon, 13 Jan 2020 19:24:54 +0000 (22:24 +0300)]
test: Use THREAD_* wrappers in del_notify/del_wait

4 years agotest: move threads created with THREAD_START() to realtime scheduling class too
Azat Khuzhin [Mon, 13 Jan 2020 19:24:54 +0000 (22:24 +0300)]
test: move threads created with THREAD_START() to realtime scheduling class too

4 years agotest: put thread into real time scheduling class on osx for better latencies
Azat Khuzhin [Sun, 12 Jan 2020 21:33:39 +0000 (00:33 +0300)]
test: put thread into real time scheduling class on osx for better latencies

4 years agoMerge branch 'ci-improvements'
Azat Khuzhin [Mon, 13 Jan 2020 19:27:32 +0000 (22:27 +0300)]
Merge branch 'ci-improvements'

* ci-improvements:
  travis-ci: measure build/tests time
  travis-ci: drop travis_wait (does not work with sub processes)
  cmake: do not print used method (EVENT_SHOW_METHOD) while running tests
  cmake: run regress test quietly like autotools (makes CI logs cleaner)

4 years agotravis-ci: measure build/tests time
Azat Khuzhin [Mon, 13 Jan 2020 19:24:54 +0000 (22:24 +0300)]
travis-ci: measure build/tests time

4 years agotravis-ci: drop travis_wait (does not work with sub processes)
Azat Khuzhin [Mon, 13 Jan 2020 19:24:54 +0000 (22:24 +0300)]
travis-ci: drop travis_wait (does not work with sub processes)

Refs: https://github.com/travis-ci/travis-ci/issues/8526

4 years agocmake: do not print used method (EVENT_SHOW_METHOD) while running tests
Azat Khuzhin [Mon, 13 Jan 2020 19:24:54 +0000 (22:24 +0300)]
cmake: do not print used method (EVENT_SHOW_METHOD) while running tests

autotools don't, plus this will make CI logs cleaner

4 years agocmake: run regress test quietly like autotools (makes CI logs cleaner)
Azat Khuzhin [Mon, 13 Jan 2020 19:24:54 +0000 (22:24 +0300)]
cmake: run regress test quietly like autotools (makes CI logs cleaner)

4 years agoAdd callback support for error pages
nntrab [Tue, 9 Feb 2016 18:01:00 +0000 (18:01 +0000)]
Add callback support for error pages

The existing error pages are very basic and don't allow for
multi-lingual support or for conformity with other pages in a web site.
The aim of the callback functionality is to allow custom error pages to
be supported for calls to evhttp_send_error() by both calling
applications and Libevent itself.

A backward-incompatible change has been made to the title of error pages
sent by evhttp_send_error(). The original version of the function used
the reason argument as part of the title. That might have unforeseen
side-effects if it contains HTML tags. Therefore the title has been
changed to always use the standard status text.

An example of the error callback can be found in this
[version](https://github.com/libevent/libevent/files/123607/http-server.zip)
of the 'http-server' sample. It will output error pages with very bright
backgrounds, the error code using a very large font size and the reason.

Closes: #323 (cherr-picked from PR)
4 years agoMerge branch 'http-connect'
Azat Khuzhin [Sun, 12 Jan 2020 12:34:51 +0000 (15:34 +0300)]
Merge branch 'http-connect'

After this patchset http-connect works with pproxy [1]:

    $ pproxy -l http://:8000/ -vvv &
    $ http-connect //127.1:8000 http://kernel.org:80/

  [1]: https://pypi.org/project/pproxy/

* http-connect:
  http-connect: do not check connection on GET cb
  http-connect: set Host header (for CONNECT and GET) (like curl)
  http-connect: cleanup and helpers
  http: do not close connection for CONNECT
  http: do not assume body for CONNECT

Fixes: #946
4 years agohttp-connect: do not check connection on GET cb
Azat Khuzhin [Sun, 12 Jan 2020 12:31:50 +0000 (15:31 +0300)]
http-connect: do not check connection on GET cb

4 years agohttp-connect: set Host header (for CONNECT and GET) (like curl)
Azat Khuzhin [Sun, 12 Jan 2020 12:24:35 +0000 (15:24 +0300)]
http-connect: set Host header (for CONNECT and GET) (like curl)

4 years agohttp-connect: cleanup and helpers
Azat Khuzhin [Sun, 12 Jan 2020 12:14:24 +0000 (15:14 +0300)]
http-connect: cleanup and helpers

4 years agohttp: do not close connection for CONNECT
Azat Khuzhin [Sun, 12 Jan 2020 12:29:48 +0000 (15:29 +0300)]
http: do not close connection for CONNECT

4 years agohttp: do not assume body for CONNECT
Azat Khuzhin [Sun, 12 Jan 2020 10:43:18 +0000 (13:43 +0300)]
http: do not assume body for CONNECT

4 years agoAdded uninstall target check to cmakelists
Dimo Markov [Wed, 8 Jan 2020 18:37:16 +0000 (20:37 +0200)]
Added uninstall target check to cmakelists

4 years agoFix compilation without OPENSSL_API_COMPAT
Azat Khuzhin [Sun, 5 Jan 2020 16:02:22 +0000 (19:02 +0300)]
Fix compilation without OPENSSL_API_COMPAT

Use the following for openssl 1.1+:
- X509_getm_notBefore over X509_get_notBefore
- X509_getm_notAfter  over X509_get_notAfter
- use OPENSSL_VERSION_NUMBER over SSLeay()
- add missing headers

Refs: openssl/openssl@0b7347effee5

4 years agoevutil_time: Implements usleep() using wait funtion on Windows
yuangongji [Fri, 27 Dec 2019 09:53:28 +0000 (17:53 +0800)]
evutil_time: Implements usleep() using wait funtion on Windows

4 years agoInitialize variable to 0 replace use memset function in sample/hello-world.c
yangyongsheng [Sun, 29 Dec 2019 12:52:17 +0000 (20:52 +0800)]
Initialize variable to 0 replace use memset function in sample/hello-world.c

4 years agoappveyor: switch to Previous Visual Studio 2019 (VS issues after update)
Azat Khuzhin [Tue, 10 Dec 2019 06:25:39 +0000 (09:25 +0300)]
appveyor: switch to Previous Visual Studio 2019 (VS issues after update)

After update [1] of the Visual Studio 2019 image cmake unable to find
path to the c compiler [2]:

    cmake : CMake Error at CMakeLists.txt:47 (project):
    At line:1 char:1
    + cmake -G 'Visual Studio 16 2019' -A x64 ..
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (CMake Error at ...t:47 (project)::String) [], RemoteException
        + FullyQualifiedErrorId : NativeCommandError

      The CMAKE_C_COMPILER:
        C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe
      is not a full path to an existing compiler tool.

  [1]: https://github.com/appveyor/ci/issues/3231
       https://www.appveyor.com/updates/2019/12/09/
  [2]: https://ci.appveyor.com/project/libevent/libevent/builds/29431286/job/a68h7dn9rcride9g

4 years agoAdd support for priority inheritance
Andre Pereira Azevedo Pinto [Thu, 5 Dec 2019 01:56:54 +0000 (17:56 -0800)]
Add support for priority inheritance

Add support for posix mutex priority inheritance. This is important to
avoid priority inversion in systems running with threads with different
priorities.

Signed-off-by: Andre Azevedo <andre.azevedo@gmail.com>
4 years agocmake: set CMAKE_{RUNTIME,LIBRARY,ARCHIVE}_OUTPUT_DIRECTORY they are not defined
Azat Khuzhin [Sat, 30 Nov 2019 12:48:36 +0000 (15:48 +0300)]
cmake: set CMAKE_{RUNTIME,LIBRARY,ARCHIVE}_OUTPUT_DIRECTORY they are not defined

This will allow overriding them in parent cmake rules, i.e. if libevent
is used via add_subdirectory().

Closes: #931
4 years agocmake: use CMAKE_LIBRARY_OUTPUT_DIRECTORY for the final shared library symlink
Azat Khuzhin [Sat, 30 Nov 2019 12:53:52 +0000 (15:53 +0300)]
cmake: use CMAKE_LIBRARY_OUTPUT_DIRECTORY for the final shared library symlink

Fixes: 669a53f3 ("cmake: set library names to be the same as with autotools")
4 years agoappveyor: fix EVENT_CMAKE_OPTIONS expansion (for multiple arguments)
Azat Khuzhin [Sun, 17 Nov 2019 20:22:53 +0000 (23:22 +0300)]
appveyor: fix EVENT_CMAKE_OPTIONS expansion (for multiple arguments)

Fixes: 63f73ee2 ("CI: integrate testing for components export")
4 years agotest-ratelim: calculate timers bias (for slow CPUs) to avoid false-positive
Azat Khuzhin [Sun, 17 Nov 2019 15:13:51 +0000 (18:13 +0300)]
test-ratelim: calculate timers bias (for slow CPUs) to avoid false-positive

This can be/should be done for regression tests too.

Refs: https://ci.appveyor.com/project/libevent/libevent/builds/28916689/job/kg621aa194a0qbym
Refs: https://github.com/libevent/libevent/pull/917#issuecomment-553811834
v2: EVENT_BASE_FLAG_PRECISE_TIMER

4 years agomailmap: add name/email aliases for yuangongji (name and email)
Azat Khuzhin [Sun, 17 Nov 2019 12:41:22 +0000 (15:41 +0300)]
mailmap: add name/email aliases for yuangongji (name and email)

Before:
  $ git log --format='%aE %aN' --author=yuangongji | sort | uniq -c
       30 82787816@qq.com yuangongji
        1 82787816@qq.com yuangongji (A)

After:
  $ git log --format='%aE %aN' --author=yuangongji | sort | uniq -c
       34 yuangongji@foxmail.com yuangongji

4 years agoMerge #929 -- cmake package improvements
Azat Khuzhin [Sat, 16 Nov 2019 23:45:54 +0000 (02:45 +0300)]
Merge #929 -- cmake package improvements

Example:

  find_package(Libevent 2.2.0 REQUIRED COMPONENTS core)
  add_executable(test test.c)
  target_link_libraries(test ${LIBEVENT_LIBRARIES})

* upstream/pr/929:
  CI: integrate testing for components export
  cmake: test for find_package()
  cmake: improve package config file

4 years agoappveyor: fix openssl version mismatch warning
yuangongji [Tue, 22 Oct 2019 14:29:12 +0000 (22:29 +0800)]
appveyor: fix openssl version mismatch warning

yuangongji:

  "Many warnings appear when building and running with Visual Studio 2019 in Appveyor:

   WARN C:\projects\libevent\test\regress_ssl.c:210: Version mismatch for openssl: compiled with 1000214f but running with 1000212f

   Simply add the openssl binary to the "PATH" environment variable to fix it.

   I wrote a simple demo to reproduce it: https://github.com/ygj6/verify
   I see there are dozens of openssl libraries in the system of appveyor: https://ci.appveyor.com/project/ygj6/verify/builds/28290688
   If you do not specify which openssl to use, the system cannot find the correct library."

4 years agoappveyor: disable parallel tests execution
Azat Khuzhin [Sat, 16 Nov 2019 23:37:59 +0000 (02:37 +0300)]
appveyor: disable parallel tests execution

Refs: https://github.com/libevent/libevent/pull/917#issuecomment-553784701

4 years agoCI: integrate testing for components export
yuangongji [Thu, 14 Nov 2019 10:34:56 +0000 (18:34 +0800)]
CI: integrate testing for components export

4 years agocmake: test for find_package()
yuangongji [Thu, 14 Nov 2019 10:28:31 +0000 (18:28 +0800)]
cmake: test for find_package()

4 years agocmake: improve package config file
yuangongji [Thu, 7 Nov 2019 10:26:47 +0000 (18:26 +0800)]
cmake: improve package config file

4 years agoLink with iphlpapi only on windows
Azat Khuzhin [Wed, 6 Nov 2019 18:41:38 +0000 (21:41 +0300)]
Link with iphlpapi only on windows

Fixes: 9fecb59a ("Parse IPv6 scope IDs.")
Refs: #923

4 years agoParse IPv6 scope IDs.
Philip Homburg [Tue, 29 Oct 2019 14:48:53 +0000 (15:48 +0100)]
Parse IPv6 scope IDs.

4 years agoRelax bufferevent_connect_hostname_emfile
Azat Khuzhin [Thu, 31 Oct 2019 06:18:58 +0000 (09:18 +0300)]
Relax bufferevent_connect_hostname_emfile

Do not do any assumptions on the error for the EMFILE from
getaddrinfo(), expect just any error.

Fixes: #924
4 years agoautotools: fails build when need but can not find openssl
yuangongji [Sat, 26 Oct 2019 14:31:18 +0000 (22:31 +0800)]
autotools: fails build when need but can not find openssl

4 years agocmake: eliminate duplicate installation of public headers
yuangongji [Fri, 25 Oct 2019 13:54:13 +0000 (21:54 +0800)]
cmake: eliminate duplicate installation of public headers

5 years agoMerge pull request #915 from ygj6 -- evutil_socketpair win32 fixes
Azat Khuzhin [Mon, 21 Oct 2019 19:21:19 +0000 (22:21 +0300)]
Merge pull request #915 from ygj6 -- evutil_socketpair win32 fixes

* upstream/pr/915:
  appveyor: add vs2019 os to test some new features brought by Win10
  test: add testcase for evutil_socketpair()
  evutil: make evutil_socketpair() have the same behavior on Windows with build number lower and higher than 17063

5 years agoappend to CMAKE_MODULE_PATH
Michael Davidsaver [Mon, 21 Oct 2019 17:36:49 +0000 (10:36 -0700)]
append to CMAKE_MODULE_PATH

Don't override any -DCMAKE_MODULE_PATH= passed from CLI
to eg. test custom Platform/ support.

5 years agoappveyor: add vs2019 os to test some new features brought by Win10
yuangongji [Fri, 18 Oct 2019 15:32:14 +0000 (23:32 +0800)]
appveyor: add vs2019 os to test some new features brought by Win10

5 years agotest: add testcase for evutil_socketpair()
yuangongji [Fri, 18 Oct 2019 13:11:37 +0000 (21:11 +0800)]
test: add testcase for evutil_socketpair()

5 years agoevutil: make evutil_socketpair() have the same behavior on Windows with build number...
yuangongji [Fri, 18 Oct 2019 13:03:40 +0000 (21:03 +0800)]
evutil: make evutil_socketpair() have the same behavior on Windows with build number lower and higher than 17063

5 years agoDo not use sysctl.h on linux (it had been deprecated)
Azat Khuzhin [Tue, 15 Oct 2019 22:11:51 +0000 (01:11 +0300)]
Do not use sysctl.h on linux (it had been deprecated)

It had been deprecated for a long time (AFAIK), but since
glibc-2.29.9000-309-g744e829637 it produces a #warning

5 years agoevutil: implement socketpair with unix domain socket on Win10
yuangongji [Sat, 12 Oct 2019 10:45:52 +0000 (18:45 +0800)]
evutil: implement socketpair with unix domain socket on Win10

5 years agotravis-ci: add OPENSSL_1_1=yes for the openssl 1.1 to distinguish it in list
Azat Khuzhin [Mon, 14 Oct 2019 20:22:55 +0000 (23:22 +0300)]
travis-ci: add OPENSSL_1_1=yes for the openssl 1.1 to distinguish it in list

5 years agotravis-ci: use matrix.include over env.matrix/matrix.exclude for coveralls
Azat Khuzhin [Mon, 14 Oct 2019 20:20:23 +0000 (23:20 +0300)]
travis-ci: use matrix.include over env.matrix/matrix.exclude for coveralls

5 years agotravis-ci: build with clang only basic configurations
Azat Khuzhin [Mon, 14 Oct 2019 19:32:01 +0000 (22:32 +0300)]
travis-ci: build with clang only basic configurations

I tried to exclude clang instead (for PRs), but matrix.exclude cannot
have conditions (i..e matrix.exclude.if).

5 years agoUse matrix.include.if over matrix.exclude.if for doxygen
Azat Khuzhin [Mon, 14 Oct 2019 09:20:45 +0000 (12:20 +0300)]
Use matrix.include.if over matrix.exclude.if for doxygen

And use if.repo over if.slug

Fixes: aeb014cc ("Do not try to deploy documentaion for PR")
5 years agoDo not try to deploy documentaion for PR
Azat Khuzhin [Sun, 13 Oct 2019 23:49:55 +0000 (02:49 +0300)]
Do not try to deploy documentaion for PR

Anyway access to security variables is forbidden for PRs.

v2: use travis-ci conditions, to avoid running addons

5 years agoFix all all yamllint warnings in travis/appveyor rules
Azat Khuzhin [Tue, 8 Oct 2019 21:16:50 +0000 (00:16 +0300)]
Fix all all yamllint warnings in travis/appveyor rules

5 years agoappveyor: do not allow any failures
Azat Khuzhin [Tue, 8 Oct 2019 21:13:01 +0000 (00:13 +0300)]
appveyor: do not allow any failures

Yes we still have flacky tests, but anyway two main configuration can
fail too (and they do fail from time to time) so let's not allow any
failures and see how this will go.

(Credits to @ygj6 via #910)

5 years agoappveyor: fix build script for compiling using mingw-w64
yuangongji [Tue, 8 Oct 2019 14:01:01 +0000 (22:01 +0800)]
appveyor: fix build script for compiling using mingw-w64

5 years agosample/https-client: link crypt32 explicitly when build with mingw-w64
yuangongji [Tue, 8 Oct 2019 13:38:58 +0000 (21:38 +0800)]
sample/https-client: link crypt32 explicitly when build with mingw-w64

5 years agoMerge remote-tracking branch 'upstream/pr/908'
Azat Khuzhin [Mon, 7 Oct 2019 19:10:14 +0000 (22:10 +0300)]
Merge remote-tracking branch 'upstream/pr/908'

* upstream/pr/908:
  Avoid transforming base C_FLAGS set deliberately

5 years agoFix compat with NetBSD >= 10
Kamil Rytarowski [Thu, 3 Oct 2019 23:26:47 +0000 (01:26 +0200)]
Fix compat with NetBSD >= 10

kevent::udata was switched from intptr_t to void*.

Handle both cases with the GCC extension typeof().

5 years agoAvoid transforming base C_FLAGS set deliberately
William A Rowe Jr [Thu, 3 Oct 2019 18:40:52 +0000 (11:40 -0700)]
Avoid transforming base C_FLAGS set deliberately

The CMAKE_C_FLAGS_DEBUG, CMAKE_C_FLAGS_RELEASE, CMAKE_C_FLAGS_MINSIZEREL
and CMAKE_C_FLAGS_RELWITHDEBINFO options are correctly and deliberately
toggled to use the libcmt (/MT) flag options in place of the usual
msvcrt (/MD) options, but this isn't necessarily desired by the user.
The default choice can be overriden with the EVENT__MSVC_STATIC_RUNTIME
cmake option.

However, the /MD flag that is the choice of CMake only enters into
play for the four types of builds above. If the user introduces another
CMAKE_BUILD_TYPE, the base CMAKE_C_FLAGS must not be manipulated, as
that value (and the CMAKE_C_FLAGS_{custom} value) have been explicitly
chosen by the user/developer deploying this library, and the mismatch
between these flags in different dependencies results in link errors.

The CMake build schema itself doesn't place an /MD flag in CMAKE_BUILD_TYPE
so any /M compile option in that variable needs to be retained.

Signed-off-by: William Rowe <wrowe@pivotal.io>
Signed-off-by: Yechiel Kalmenson <ykalmenson@pivotal.io>
5 years agotinytest: support timeout on Windows
yuangongji [Thu, 26 Sep 2019 13:47:51 +0000 (21:47 +0800)]
tinytest: support timeout on Windows

5 years agoMerge branch 'upstream/pr/899' (evbuffer_freeze testcase enhancements)
Azat Khuzhin [Sun, 22 Sep 2019 15:44:55 +0000 (18:44 +0300)]
Merge branch 'upstream/pr/899' (evbuffer_freeze testcase enhancements)

* upstream/pr/899:
  improve the description of parameter to evbuffer_read()
  regress_buffer: improve testcase for evbuffer_freeze()