]> granicus.if.org Git - libevent/log
libevent
8 years agoBump version to 2.1.7-beta everywhere
Azat Khuzhin [Tue, 1 Nov 2016 21:31:31 +0000 (00:31 +0300)]
Bump version to 2.1.7-beta everywhere

- cmake basic
- cmake detecting from git -- event_fuzzy_version_from_git()
- autotools
- win32
- appveyor

8 years agoUpdate changelog for 2.1.7-rc
Azat Khuzhin [Tue, 1 Nov 2016 21:25:38 +0000 (00:25 +0300)]
Update changelog for 2.1.7-rc

8 years agoREADME: update AUTHORS
Azat Khuzhin [Tue, 1 Nov 2016 21:16:54 +0000 (00:16 +0300)]
README: update AUTHORS

$ git log --format='%an' HEAD...refs/tags/release-2.1.6-beta | sort -u | xargs -n1 -i bash -c 'fgrep -q "{}" README.md || echo {}'

8 years agotravis-ci/osx: install lcov
Azat Khuzhin [Thu, 3 Nov 2016 12:00:15 +0000 (15:00 +0300)]
travis-ci/osx: install lcov

8 years agotest/regress: cover a polling of invalid fd
Tim Hentenaar [Fri, 15 Jul 2016 00:27:23 +0000 (02:27 +0200)]
test/regress: cover a polling of invalid fd

Test that an event's callback is called if the fd is closed prior to being
polled for activity.

azat: make it run only for poll backend/method, and do not close fd
twice

8 years agopoll: Prevent libevent from spinning if POLLNVAL occurs
Tim Hentenaar [Thu, 14 Jul 2016 13:45:01 +0000 (15:45 +0200)]
poll: Prevent libevent from spinning if POLLNVAL occurs

This can happen, for example if libevent is being used to poll fds given
by another library where the other library closes the fds without
notifying the program using it that said fds were closed. In this case,
libevent will simply spin on poll() since there are active fds, but
won't call any event callback to handle the condition.

In epoll case after socket closed it automatically removed from epfd, so
IOW it will not spin in epoll* API, just a timeout.

Fixes: #379
8 years agoUse coveralls.io via travis
Azat Khuzhin [Tue, 1 Nov 2016 20:39:41 +0000 (23:39 +0300)]
Use coveralls.io via travis

8 years agoFix cmake -DEVENT__COVERAGE=ON
Azat Khuzhin [Tue, 1 Nov 2016 20:33:11 +0000 (23:33 +0300)]
Fix cmake -DEVENT__COVERAGE=ON

- do not use compiler check from the root cmake rules with syntax error,
  let CodeCoverage check it
- fix CodeCoverage to check C compiler not CXX
- case insensitive checking of CMAKE_BUILD_TYPE
- replace flags with --coverage, and fix flags with linking with
  --coverate, otherwise it will not compile during checking flags and
  fails.

8 years agoTesting with vagrant for 6 OS and cmake+autoconf
Azat Khuzhin [Mon, 31 Oct 2016 16:33:28 +0000 (19:33 +0300)]
Testing with vagrant for 6 OS and cmake+autoconf

OS:
- linux
- freebsd
- osx
- netbsd
- solaris
- win

And mostly they all are more or less fine, except for timing issues

Also it supports next environment variables:
- NO_PKG
- NO_CMAKE
- NO_AUTOTOOLS

For instance if you run ubuntu box seocnd time, then you can run with:
$ NO_PKG=true vagrant provision ubuntu

8 years agoautogen.sh: learn about gmake
Azat Khuzhin [Mon, 31 Oct 2016 19:37:16 +0000 (22:37 +0300)]
autogen.sh: learn about gmake

Fixes: 69cce257eb6183dda114d8f5b8ca0325cfabe2e1
("69cce257eb6183dda114d8f5b8ca0325cfabe2e1")

8 years agoautogen.sh: remove all autoconf/automake caches, if any
Azat Khuzhin [Mon, 31 Oct 2016 09:01:20 +0000 (12:01 +0300)]
autogen.sh: remove all autoconf/automake caches, if any

Otherwise if you for example share root of libevent repository with some
vm (for example windows+cygwin) then if you try to build with configure
on host, and then on guest it will fail, so let's just ignore this since
autogen.sh is just for this -- cleaning all stuff.

8 years agocmake: fix finding python2, and check that it is really 2
Azat Khuzhin [Sun, 30 Oct 2016 08:19:43 +0000 (11:19 +0300)]
cmake: fix finding python2, and check that it is really 2

python version check removed in a4d044c0cd97f68b4b3dde414b83d609719d33d7
("cmake: use PYTHON_EXECUTABLE to find python2"), but in
bcb990ab7cf4921c2c30a1aa4fcb4c0131fffe94 ("cmake/win32: fix running
regress, but fixing finding python2 interpreter") we set
PYTHON_EXECUTABLE only if it exists.

8 years agoIgnore temporary configure files
Azat Khuzhin [Sun, 30 Oct 2016 22:56:37 +0000 (01:56 +0300)]
Ignore temporary configure files

So if you kill configure, git still should ignore them.

8 years agocmake: fix CheckFunctionExistsEx/CheckPrototypeDefinition (CMP0054)
Azat Khuzhin [Wed, 26 Oct 2016 15:04:07 +0000 (18:04 +0300)]
cmake: fix CheckFunctionExistsEx/CheckPrototypeDefinition (CMP0054)

8 years agocmake: cleanup
Zonr Chang [Wed, 24 Aug 2016 08:19:01 +0000 (16:19 +0800)]
cmake: cleanup

- Remove a redundant check on netdb.h (EVENT__HAVE_NETDB_H).
- Properly setup EVENT__SIZEOF_SSIZE_T for the case where "ssize_t" is
  not "int".
- Remove unused EVENT__HAVE_PTHREAD.
- Set EVENT__HAVE_LIBZ instead of EVENT__HAVE_ZLIB (and remove the
  latter).

Closes: #391 (cherry-picked from PR)
8 years agouse ev_uint16_t instead of unsigned short for port
Thomas Bernard [Sat, 13 Dec 2014 18:42:42 +0000 (19:42 +0100)]
use ev_uint16_t instead of unsigned short for port

Like in `sockaddr_in` structure in /usr/include/netinet/in.h

@azat: convert all other users (bench, compat, ..) and tweak message
Fixes: #178
Fixes: #196
Refs: 6bf1ca78
Link: https://codereview.appspot.com/156040043/#msg4
8 years agocmake/win32: fix running regress, but fixing finding python2 interpreter
Azat Khuzhin [Tue, 25 Oct 2016 21:51:56 +0000 (00:51 +0300)]
cmake/win32: fix running regress, but fixing finding python2 interpreter

  Could not find executable C:/projects/libevent/build/bin/regress
  Looked in the following places:
  C:/projects/libevent/build/bin/regress
  C:/projects/libevent/build/bin/regress.exe
  ...
   9/13 Test  #9: regress__WIN32_debug ................***Not Run   0.00 sec

Link: https://ci.appveyor.com/project/nmathewson/libevent/build/2.1.6.271/job/wvy2jp7uojcut5cx#L1256
Fixes: #411
8 years agoREADME.md: fix typo: ar -> are
Simone Basso [Fri, 21 Oct 2016 08:49:22 +0000 (10:49 +0200)]
README.md: fix typo: ar -> are

8 years agotravis-ci: use container-based infrastructure
Azat Khuzhin [Sun, 16 Oct 2016 22:05:38 +0000 (01:05 +0300)]
travis-ci: use container-based infrastructure

- by disabling sudo
- and since we use addons.apt.packages we don't need apt-get update, that requires sudo

Link: https://docs.travis-ci.com/user/migrating-from-legacy/
8 years agotravis-ci/osx: fix compiling/linking openssl libraries
Azat Khuzhin [Sun, 16 Oct 2016 20:46:09 +0000 (23:46 +0300)]
travis-ci/osx: fix compiling/linking openssl libraries

And we need that $(echo /path/*) otherwise bash will expand it only during
assignment that variable to another one, and this doesn't work correctly.

8 years agotravis-ci: use gcc-5 (fixes osx|gcc failures)
Azat Khuzhin [Sun, 16 Oct 2016 18:48:59 +0000 (21:48 +0300)]
travis-ci: use gcc-5 (fixes osx|gcc failures)

Refs: travis-ci/travis-ci#4587

8 years agoMake it build using OpenSSL 1.1.0
Kurt Roeckx [Mon, 19 Sep 2016 20:05:15 +0000 (22:05 +0200)]
Make it build using OpenSSL 1.1.0

Rebased (azat):
- tabs instead of whitespaces
- make openssl-compat.h safe for complex expressions
- do not call sk_SSL_COMP_free() in 1.1 (fixes double free)

TODO:
- clean methods_bufferevent

Closes: #397 (cherry-picked)
8 years agoDon't call BIO_number_{read|written} on NULL BIOs.
Adam Langley [Thu, 13 Oct 2016 00:49:17 +0000 (17:49 -0700)]
Don't call BIO_number_{read|written} on NULL BIOs.

OpenSSL doesn't document the behaviour of these functions when given a
NULL BIO, and it happens to return zero at the moment. But don't depend
on that.

Closes: #406 (cherry-picked)
8 years agoSwitch from a 512 to 2048-bit RSA key.
Adam Langley [Thu, 13 Oct 2016 00:49:10 +0000 (17:49 -0700)]
Switch from a 512 to 2048-bit RSA key.

The 512 bit key is too small to sign larger hashes. This can cause the
regression tests to fail depending on the defaults in libssl.

8 years agoMerge branch 'contrib-guide-v2'
Azat Khuzhin [Wed, 5 Oct 2016 12:52:41 +0000 (15:52 +0300)]
Merge branch 'contrib-guide-v2'

Something that should help with reviewing patches.

* contrib-guide-v2:
  Add CONTRIBUTING.md (with checkpatch.sh examples)
  Add checkpatch script
  Add config for clang-format
  Add config for uncrustify

Refs: #301

8 years agoAdd CONTRIBUTING.md (with checkpatch.sh examples)
Azat Khuzhin [Mon, 15 Feb 2016 20:43:10 +0000 (23:43 +0300)]
Add CONTRIBUTING.md (with checkpatch.sh examples)

8 years agoAdd checkpatch script
Azat Khuzhin [Wed, 5 Oct 2016 10:28:04 +0000 (13:28 +0300)]
Add checkpatch script

Support:
- files
- files-diffs
- patches
- git-refs

8 years agoAdd config for clang-format
Azat Khuzhin [Wed, 5 Oct 2016 11:00:55 +0000 (14:00 +0300)]
Add config for clang-format

8 years agoAdd config for uncrustify
Azat Khuzhin [Wed, 5 Oct 2016 11:00:40 +0000 (14:00 +0300)]
Add config for uncrustify

Original: https://strcpy.net/mark/libevent-uncrustify.cfg (@ellzey)

8 years agobe: just a simple mistake, reinclude the <errno.h>
Seven [Fri, 16 Sep 2016 08:37:59 +0000 (16:37 +0800)]
be: just a simple mistake, reinclude the <errno.h>

include the <errno.h> twice.

8 years agocmake: use PYTHON_EXECUTABLE to find python2
Azat Khuzhin [Tue, 4 Oct 2016 20:21:37 +0000 (23:21 +0300)]
cmake: use PYTHON_EXECUTABLE to find python2

Since most of the distros have symlinks for this.

8 years agoMerge branch 'force-disable-clockgettime'
Azat Khuzhin [Mon, 3 Oct 2016 00:24:28 +0000 (03:24 +0300)]
Merge branch 'force-disable-clockgettime'

* force-disable-clockgettime:
  Add -DEVENT__DISABLE_CLOCK_GETTIME switch for cmake
  Adding option to ignore clock_gettime: --disable-clock-gettime

8 years agoAdd -DEVENT__DISABLE_CLOCK_GETTIME switch for cmake
Azat Khuzhin [Mon, 3 Oct 2016 00:17:18 +0000 (03:17 +0300)]
Add -DEVENT__DISABLE_CLOCK_GETTIME switch for cmake

See-also: adc402ba5f0e15f4c77505852507f33b50f37ab6 ("Adding option to
ignore clock_gettime: --disable-clock-gettime")

8 years agoAdding option to ignore clock_gettime: --disable-clock-gettime
Vlad Shcherban [Thu, 29 Sep 2016 22:31:53 +0000 (18:31 -0400)]
Adding option to ignore clock_gettime: --disable-clock-gettime

macOS 10.12 introduced `clock_gettime` to libsystem. This means, built
on OS X 10.12 application would crash on earlier versions of OS X
because it will try to call clock_gettime. This options is useful to
make backwards compatible macOS apps.

Fixes: #398
Fixes: #399
Fixes: #400
8 years agoMerge branch 'release-2.1.6-beta-pull' release-2.1.6-beta
Azat Khuzhin [Fri, 26 Aug 2016 22:53:31 +0000 (01:53 +0300)]
Merge branch 'release-2.1.6-beta-pull'

* release-2.1.6-beta-pull:
  Bump version to 2.1.6-beta everywhere
  ChangeLog: Add brief notes
  Update changelog for 2.1.6-beta (ugh, pretty huge)
  Update AUTHORS section in README

8 years agoBump version to 2.1.6-beta everywhere
Azat Khuzhin [Wed, 13 Jul 2016 14:40:48 +0000 (17:40 +0300)]
Bump version to 2.1.6-beta everywhere

- cmake basic
- cmake detecting from git -- event_fuzzy_version_from_git()
- autotools
- win32
- appveyor

8 years agoChangeLog: Add brief notes
Azat Khuzhin [Tue, 5 Jul 2016 13:17:38 +0000 (16:17 +0300)]
ChangeLog: Add brief notes

8 years agoUpdate changelog for 2.1.6-beta (ugh, pretty huge)
Azat Khuzhin [Mon, 4 Jul 2016 15:13:02 +0000 (18:13 +0300)]
Update changelog for 2.1.6-beta (ugh, pretty huge)

Changes for:
- 2.1.5-beta: 118
- 2.1.6-beta: 350

We should really hurry with the release!

8 years agoUpdate AUTHORS section in README
Azat Khuzhin [Sun, 7 Aug 2016 20:27:22 +0000 (23:27 +0300)]
Update AUTHORS section in README

P.S. "Sebastian Hahn" was declared two times.

8 years agoFix evhttp_uriencode() regression.
Zonr Chang [Wed, 24 Aug 2016 09:16:32 +0000 (17:16 +0800)]
Fix evhttp_uriencode() regression.

http_uriencode_test() (in test/regress_http.c) has been failed after
72afe4c as "hello\0world" is encoded to "hello" instead of
"hello%00world". This is because of a misplaced overflow check which
causes the non-negative "size" specified in parameter being ignored in
within-bound URI.

Fixes: #392
8 years agoremoved unused vars
Mark Ellzey [Sun, 14 Aug 2016 21:03:56 +0000 (14:03 -0700)]
removed unused vars

8 years agopointer overflow checks for evhttp_uriencode
Mark Ellzey [Sun, 14 Aug 2016 21:00:02 +0000 (14:00 -0700)]
pointer overflow checks for evhttp_uriencode

Check to make sure pointer math is all OK.

8 years agotests: use waitpid(..., WNOWAIT) to fix failing of main/fork under solaris
Azat Khuzhin [Thu, 11 Aug 2016 13:15:45 +0000 (16:15 +0300)]
tests: use waitpid(..., WNOWAIT) to fix failing of main/fork under solaris

According to solaris docs:
  "One instance of a SIGCHLD signal is queued for each child process whose
  status has changed. If waitpid() returns because the status of a child
  process is available, and WNOWAIT was not specified in options, any pending
  SIGCHLD signal associated with the process ID of that child process is
  discarded. Any other pending SIGCHLD signals remain pending."

And interesting thing that it works if you add sleep(1) before waitpid(), and
also if you run with --verbose (some race or what).

But linux doesn't support WNOWAIT in waitpid() so add detection into
cmake/autotools.

Fixes: #387
Link: https://bugzilla.redhat.com/show_bug.cgi?id=840782
8 years agotest: replace sleeping with syncing pair in main/fork
Azat Khuzhin [Thu, 11 Aug 2016 10:43:14 +0000 (13:43 +0300)]
test: replace sleeping with syncing pair in main/fork

About this syncing pair:
- read endpoint, must be blocked, to make it a checkpoint or smth like this
- write endpoint, must be nonblocking, to avoid readcb hung

Refs: #387

8 years agotravis: split long lines, and make it cleaner
Azat Khuzhin [Thu, 11 Aug 2016 06:27:50 +0000 (09:27 +0300)]
travis: split long lines, and make it cleaner

8 years agotravis: fix autotools on osx by reinstalling libtool
Azat Khuzhin [Wed, 10 Aug 2016 21:18:04 +0000 (00:18 +0300)]
travis: fix autotools on osx by reinstalling libtool

Link: mkrufky/libdvbtee#22

8 years agobe_sock: handle readv() returns ECONNREFUSED (freebsd 9.2)
Azat Khuzhin [Wed, 10 Aug 2016 13:04:33 +0000 (16:04 +0300)]
be_sock: handle readv() returns ECONNREFUSED (freebsd 9.2)

During testing sometimes bufferevent/bufferevent_connect_fail_eventcb fails,
and after some digging I found that this was the case when connect() doesn't
return ECONNREFUSED immediately, and instead next operation will return it (in
our case evbuffer_read()->readv(), needless to say that after this
bufferevent_writecb() called and it checks error with getsockopt() but of
course it doesn't return any error), so this patch checks "errno" after
"readv()" and installs "bufev::connection_refused" flag, to handle this from
writecb and only once.

Fixes: bufferevent/bufferevent_connect_fail_eventcb
Fixes: bufferevent/bufferevent_connect_fail_eventcb_defer
Refs: #388

8 years agotest/http: do not run tests that based on backlog filling (freebsd)
Azat Khuzhin [Wed, 10 Aug 2016 13:50:19 +0000 (16:50 +0300)]
test/http: do not run tests that based on backlog filling (freebsd)

I cannot find any other solution for now, so simply ignore them for now, we
should think about normal fix for this.

Refs: #388

8 years agoevutil: mark ai_find_protocol() static (prototype-less)
Azat Khuzhin [Wed, 10 Aug 2016 13:09:09 +0000 (16:09 +0300)]
evutil: mark ai_find_protocol() static (prototype-less)

8 years agotest/bufferevent/iocp: fix test name for "bufferevent_connect_fail_eventcb"
Azat Khuzhin [Wed, 10 Aug 2016 09:07:32 +0000 (12:07 +0300)]
test/bufferevent/iocp: fix test name for "bufferevent_connect_fail_eventcb"

8 years agoFix getaddrinfo under solaris (for multiprotocol case)
Azat Khuzhin [Mon, 9 May 2016 22:34:28 +0000 (22:34 +0000)]
Fix getaddrinfo under solaris (for multiprotocol case)

During testing on solaris 11.3, util/getaddrinfo failed at:
  memset(&hints, 0, sizeof(hints));
  hints.ai_flags = EVUTIL_AI_NUMERICHOST;
  r = evutil_getaddrinfo("1.2.3.4", NULL, &hints, &ai);
  tt_assert(ai_find_by_protocol(ai, IPPROTO_TCP));

And this is because solaris's getaddrinfo() returns:
$6 = {
  ai_flags = 32,
  ai_family = 2,
  ai_socktype = 0,
  ai_protocol = 0, <-- no proto
  ai_addrlen = 16,
  ai_canonname = 0x0,
  ai_addr = 0x815d658,
  ai_next = 0x0 <-- nothing else
}

So we should emulate this too.

Plus introduce helper that will search through all results, not only first one.

Fixes: util/getaddrinfo
Fixes: #354
8 years agocmake/solaris: set CMAKE_REQUIRED_LIBRARIES to fix functions detections
Azat Khuzhin [Tue, 9 Aug 2016 21:27:59 +0000 (00:27 +0300)]
cmake/solaris: set CMAKE_REQUIRED_LIBRARIES to fix functions detections

Otherwise we will not detect next functions for instance:
- gethostbyname_r # and related

And now both autotools/cmake builds passes all regress tests in basic env (on
solaris of course).

Fixes: dns/client_fail_requests_getaddrinfo
8 years agocmake/solaris: fix building (link with socket,nsl)
Azat Khuzhin [Tue, 9 Aug 2016 21:16:48 +0000 (00:16 +0300)]
cmake/solaris: fix building (link with socket,nsl)

8 years agoMerge branch 'appveyor-cmake-v6'
Azat Khuzhin [Tue, 9 Aug 2016 12:49:01 +0000 (15:49 +0300)]
Merge branch 'appveyor-cmake-v6'

This patch set introduces matrix for appveyor and fixes bugs related to win32,
during debugging this matrix. This should greatly reduce number of work for
making a release ('check under windows' part only).

Right now tests on appveyor still failes in summary, but we should dig into
problems, not hide them.

Test matrix looks like this:
- autotools
- autotools --disable-openssl
- autotools --disable-thread-support
- autotools --disable-debug-mode
- autotools --disable-malloc-replacement
- cmake
- cmake -DEVENT__DISABLE_OPENSSL=ON
- cmake -DEVENT__DISABLE_THREAD_SUPPORT=ON
- cmake -DEVENT__DISABLE_DEBUG_MODE=ON
- cmake -DEVENT__DISABLE_MM_REPLACEMENT=ON
- cmake -DEVENT__ENABLE_VERBOSE_DEBUG=ON
- cmake -DCMAKE_C_FLAGS='-DUNICODE -D_UNICODE'
And takes 90min (was 7min, and this is the sad part).

* appveyor-cmake-v6:
  test/ssl: use send()/recv()/EVUTIL_ERR_RW_RETRIABLE()/EVUTIL_SOCKET_ERROR() to fix win32
  test/https_basic: increase timeout for complete write (fixes win32)
  cmake: check for ZLIB_INCLUDE_DIR, since we can have only library without headers
  autotools/win32: fix searching ssl library
  appveyor/autotools: link with openssl by passing LDFLAGS/CFLAGS
  appveyor: image already had openssl installed
  cmake/win32: do not compile regress_thread on -DEVENT__DISABLE_THREAD_SUPPORT=ON
  cmake/win32: do not compile evthread_win32 on -DEVENT__DISABLE_THREAD_SUPPORT=ON
  appveyor: check -DUNICODE -D_UNICODE according to ReleaseChecklist (cmake only)
  cmake: fix -DEVENT__ENABLE_VERBOSE_DEBUG (typo on -DUSE_DEBUG)
  test: fix building with --disable-thread-support under win32
  cmake: do not use stderr for notifications/version-info
  autoconf: fix --disable-thread-support build under win32
  appveyor: ignore failure of mingw-get
  appveyor: drop shallow_clone, since we use tags for detecting version in cmake
  appveyor: support cmake & autotools using build matrix (like travis-ci has)

Fixes: #364
8 years agotest/ssl: use send()/recv()/EVUTIL_ERR_RW_RETRIABLE()/EVUTIL_SOCKET_ERROR() to fix...
Azat Khuzhin [Tue, 9 Aug 2016 09:25:11 +0000 (12:25 +0300)]
test/ssl: use send()/recv()/EVUTIL_ERR_RW_RETRIABLE()/EVUTIL_SOCKET_ERROR() to fix win32

Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.5.107/job/k70our1xdp0ym4dm#L1906
Fixes: ssl/bufferevent_connect_sleep
8 years agotest/https_basic: increase timeout for complete write (fixes win32)
Azat Khuzhin [Tue, 9 Aug 2016 09:10:18 +0000 (12:10 +0300)]
test/https_basic: increase timeout for complete write (fixes win32)

Otherwise on win32 we got 2, but test is ok, some timings issue.

Introduced-in: c968eb3
Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.5.107/job/k70our1xdp0ym4dm#L1906
8 years agocmake: check for ZLIB_INCLUDE_DIR, since we can have only library without headers
Azat Khuzhin [Tue, 9 Aug 2016 07:56:34 +0000 (10:56 +0300)]
cmake: check for ZLIB_INCLUDE_DIR, since we can have only library without headers

8 years agoautotools/win32: fix searching ssl library
Azat Khuzhin [Mon, 8 Aug 2016 15:10:56 +0000 (18:10 +0300)]
autotools/win32: fix searching ssl library

8 years agoappveyor/autotools: link with openssl by passing LDFLAGS/CFLAGS
Azat Khuzhin [Mon, 8 Aug 2016 14:25:11 +0000 (17:25 +0300)]
appveyor/autotools: link with openssl by passing LDFLAGS/CFLAGS

This never works, hence green tests in production. and now it works:
https://ci.appveyor.com/project/azat/libevent/build/2.1.5.100/job/eib4xqfb7d3ruo16
(look by /"evthread_win32.c")

8 years agoappveyor: image already had openssl installed
Azat Khuzhin [Mon, 8 Aug 2016 12:34:57 +0000 (15:34 +0300)]
appveyor: image already had openssl installed

Fixes messages like "Version mismatch for openssl: compiled with 1000201f but
running with 1000208f" [1].

According to next link:
  http://help.appveyor.com/discussions/questions/1132-openssl-installation-issues
Refs: appveyor/ci#576
[1]: https://ci.appveyor.com/project/azat/libevent/build/2.1.5.95/job/dcy9cfoj3rfo4gdh

8 years agocmake/win32: do not compile regress_thread on -DEVENT__DISABLE_THREAD_SUPPORT=ON
Azat Khuzhin [Mon, 8 Aug 2016 12:50:46 +0000 (15:50 +0300)]
cmake/win32: do not compile regress_thread on -DEVENT__DISABLE_THREAD_SUPPORT=ON

8 years agocmake/win32: do not compile evthread_win32 on -DEVENT__DISABLE_THREAD_SUPPORT=ON
Azat Khuzhin [Mon, 8 Aug 2016 12:45:29 +0000 (15:45 +0300)]
cmake/win32: do not compile evthread_win32 on -DEVENT__DISABLE_THREAD_SUPPORT=ON

There is duplicated "evthread_win32.c" appending to ${SRC_CORE} list, leave
only one that under if EVENT__DISABLE_THREAD_SUPPORT

Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.5.96/job/44q3rgifasny7gek
8 years agoappveyor: check -DUNICODE -D_UNICODE according to ReleaseChecklist (cmake only)
Azat Khuzhin [Sun, 7 Aug 2016 20:51:21 +0000 (23:51 +0300)]
appveyor: check -DUNICODE -D_UNICODE according to ReleaseChecklist (cmake only)

Link: https://github.com/libevent/libevent/wiki/ReleaseChecklist
8 years agocmake: fix -DEVENT__ENABLE_VERBOSE_DEBUG (typo on -DUSE_DEBUG)
Azat Khuzhin [Sun, 7 Aug 2016 20:46:26 +0000 (23:46 +0300)]
cmake: fix -DEVENT__ENABLE_VERBOSE_DEBUG (typo on -DUSE_DEBUG)

Fixes: 8b228e27f57300be61b57a41a2ec8666b726dc34 ("Lot's of cmake updates")
8 years agotest: fix building with --disable-thread-support under win32
Azat Khuzhin [Sun, 7 Aug 2016 20:14:01 +0000 (23:14 +0300)]
test: fix building with --disable-thread-support under win32

8 years agocmake: do not use stderr for notifications/version-info
Azat Khuzhin [Sun, 7 Aug 2016 20:07:44 +0000 (23:07 +0300)]
cmake: do not use stderr for notifications/version-info

For all except "STATUS" message() will write to stderr, and this also includes
case when you does not have <mode> at all. Plus for every message in stderr
powershell generates exception and make appveyor fails.

Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.5.85/job/i10k7m0t80330mtr
8 years agoautoconf: fix --disable-thread-support build under win32
Azat Khuzhin [Sun, 7 Aug 2016 19:19:39 +0000 (22:19 +0300)]
autoconf: fix --disable-thread-support build under win32

Fixes: https://ci.appveyor.com/project/azat/libevent/build/job/gvud4tcqsd5bnarl
Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.6.80/job/5frnb1c3n4quxxqy
Fixes: https://ci.appveyor.com/project/azat/libevent/build/2.1.6.80/job/3wdahbrew7setmoa
8 years agoappveyor: ignore failure of mingw-get
Azat Khuzhin [Sun, 7 Aug 2016 18:30:04 +0000 (21:30 +0300)]
appveyor: ignore failure of mingw-get

Since according to doc [1], appveyour will fail the build on every powershell's
exception:
  "PowerShell script is considered successful if it finishes without exception."

[1]: https://www.appveyor.com/docs/build-configuration#powershell

8 years agoappveyor: drop shallow_clone, since we use tags for detecting version in cmake
Azat Khuzhin [Sun, 7 Aug 2016 17:52:41 +0000 (20:52 +0300)]
appveyor: drop shallow_clone, since we use tags for detecting version in cmake

8 years agoappveyor: support cmake & autotools using build matrix (like travis-ci has)
Azat Khuzhin [Sun, 19 Jun 2016 11:15:41 +0000 (14:15 +0300)]
appveyor: support cmake & autotools using build matrix (like travis-ci has)

This will allow us to avoid possible compilation regressions, and also some
failures in different environments (for example because of different
sizeof(size_t)).

For example we can avoid next issues:
- #361
- #314
- #311
(And I'm pretty sure that this is not complete list)

And of course it reduce job for maintainers.
But it also have one downside, appveyor doesn't have such concurrency like
travis-ci, so it can take a while to finish the whole build, but we can resolve
this later, or reduce build matrix to only one for autotools and one for cmake.

Fixes: #364
8 years agoIgnore `make dist` generated files
Azat Khuzhin [Mon, 8 Aug 2016 15:15:41 +0000 (18:15 +0300)]
Ignore `make dist` generated files

8 years agoCheck for Mac OS X 10.4 kqueue bug properly
Mark Mentovai [Fri, 8 Jul 2016 13:43:39 +0000 (09:43 -0400)]
Check for Mac OS X 10.4 kqueue bug properly

EV_ERROR is a bit in struct kevent::flags. Other bits may be set too.

Actually we have osx builds on travis-ci, but it uses osx 10.9.5, and we don't
have warnings there, since I guess that there is no OR'ing with previous flag
in case of error, while in 10.12 there is OR.

Fixes: #377
Fixes: #376
Link: https://crbug.com/626534
Link: https://travis-ci.org/libevent/libevent/jobs/141033429
8 years agobuffer: don't mix code and declarations
Azat Khuzhin [Thu, 7 Jul 2016 10:15:41 +0000 (13:15 +0300)]
buffer: don't mix code and declarations

8 years agoFix memory leak in signal-test.c
basavesh.as [Wed, 29 Jun 2016 09:41:50 +0000 (15:11 +0530)]
Fix memory leak in signal-test.c

8 years ago[#372] check for errno.h
Mark Ellzey [Tue, 28 Jun 2016 17:37:24 +0000 (10:37 -0700)]
[#372] check for errno.h

8 years agoMerge pull request #367 from neerajbadlani/master
Mark Ellzey [Sun, 26 Jun 2016 18:15:58 +0000 (11:15 -0700)]
Merge pull request #367 from neerajbadlani/master

Update gitignore file to ignore cscope gen'ed files

8 years agobuffer: Merge branch '340-dig-v2'
Azat Khuzhin [Sat, 25 Jun 2016 22:57:45 +0000 (01:57 +0300)]
buffer: Merge branch '340-dig-v2'

All details in this two patches (it's titles), and shortlog is below.

* 340-dig-v2:
  buffer: fix overflow check in evbuffer_expand_singlechain()
  test/buffer: cover evbuffer_expand() for overflow

8 years agobuffer: fix overflow check in evbuffer_expand_singlechain()
Azat Khuzhin [Tue, 21 Jun 2016 16:49:57 +0000 (19:49 +0300)]
buffer: fix overflow check in evbuffer_expand_singlechain()

Refs: #306
Fixes: #340
Fixes: 20d6d4458bee5d88bda1511c225c25b2d3198d6c
8 years agotest/buffer: cover evbuffer_expand() for overflow
Azat Khuzhin [Wed, 22 Jun 2016 12:48:51 +0000 (15:48 +0300)]
test/buffer: cover evbuffer_expand() for overflow

Refs: #306
Refs: #340

8 years ago[Issue #313] set method to ASCII "NULL" if evhttp_method() returns NULL
Mark Ellzey [Sat, 25 Jun 2016 01:07:39 +0000 (18:07 -0700)]
[Issue #313] set method to ASCII "NULL" if evhttp_method() returns NULL

8 years agoUpdate gitignore file to ignore cscope gen'ed files
Neeraj Badlani [Thu, 23 Jun 2016 04:15:53 +0000 (21:15 -0700)]
Update gitignore file to ignore cscope gen'ed files

8 years agobuffer: Merge branch 'evbuffer-empty-chains-fixes-v4'
Azat Khuzhin [Sun, 19 Jun 2016 10:24:18 +0000 (13:24 +0300)]
buffer: Merge branch 'evbuffer-empty-chains-fixes-v4'

This fixes bug with empty-chains and
evbuffer_add_buffer()/evbuffer_remove_buffer().

* evbuffer-empty-chains-fixes-v4:
  buffer: evbuffer_add_buffer(): clean empty chains from destination buffer
  test/buffer: evbuffer_add_buffer() with empty chains
  test/buffer: evbuffer_remove_buffer() with empty chains (prepend)
  test/buffer: evbuffer_remove_buffer() with empty chains (evbuffer_add_buffer())

Reported-by: Eduardo Panisset <eduardo@anchorfree.com>
8 years agobufferevent_filter: Merge branch 'be-filter-data-stuck'
Azat Khuzhin [Sun, 19 Jun 2016 10:21:15 +0000 (13:21 +0300)]
bufferevent_filter: Merge branch 'be-filter-data-stuck'

Fixes data stuck in filters with active watermarks.

* be-filter-data-stuck:
  test/be_filter: creating test case for data stuck with active watermarks
  be_filter: avoid data stuck under active watermarks

8 years agotest/be_filter: creating test case for data stuck with active watermarks
Eduardo Panisset [Sun, 19 Jun 2016 09:09:50 +0000 (02:09 -0700)]
test/be_filter: creating test case for data stuck with active watermarks

v2: fix whitespaces
    s/int/size_t/
    use tt_int_op()
    s/malloc/calloc (to avoid possible false-positive)

8 years agobe_filter: avoid data stuck under active watermarks
Eduardo Panisset [Fri, 17 Jun 2016 17:46:32 +0000 (10:46 -0700)]
be_filter: avoid data stuck under active watermarks

Suppose we have bufferevent filter attached to bufferevent socket.
Read high watermark for bufferevent filter is configured to 4096 bytes.
Socket receives 4343 bytes. Due to watermark, 4096 bytes are transferred
from socket input buffer to filter input buffer and 247 bytes are left
in bufferevent socket.
Suppose that no more data is received through socket.

At this point 247 bytes will sit forever in input buffer of bufferevent
socket.
The patch attached solves this issue registering read callback to
filter's input buffer if it reaches its read high water mark and data
was left in corresponding underlying's input buffer.

This read callback calls filter process input function as soon as filter
input buffer falls below its read high watermark and there still is data
left in underlying input buffer. Callback is deregistered as soon as
filter input buffer falls below its read high watermark.

8 years agoFix bufferevent_pair to properly set BEV_EVENT_{READING,WRITING} on flush.
David Paschich [Sun, 22 May 2016 04:05:11 +0000 (21:05 -0700)]
Fix bufferevent_pair to properly set BEV_EVENT_{READING,WRITING} on flush.

Here's some fun. From `bufferevent.h`:
  ```
  #define BEV_EVENT_READING 0x01 /**< error encountered while reading */
  #define BEV_EVENT_WRITING 0x02 /**< error encountered while writing */
  ```

And from `event.h`:
  ```
  /** Wait for a socket or FD to become readable */
  #define EV_READ 0x02
  /** Wait for a socket or FD to become writeable */
  #define EV_WRITE 0x04
  ```

Library users have to be very careful to get this right; it turns out, the
library itself got this wrong in the `bufferevent_pair` code. It appears that
in most of the code, only `BEV_EVENT_FINISHED` will indicate whether it's read
or write; on error or timeout, it appears that "both" is assumed and not set in
the callback. I read through all the other places where `BEV_EVENT_FINISHED` is
passed to an event callback; it appears that the pair code is the only spot
that got it wrong.

azat: add TT_FORK to avoid breaking clean env, and rebase commit message
(copied from #359)
Fixes: #359
8 years agobuffer: evbuffer_add_buffer(): clean empty chains from destination buffer
Azat Khuzhin [Tue, 7 Jun 2016 15:31:48 +0000 (18:31 +0300)]
buffer: evbuffer_add_buffer(): clean empty chains from destination buffer

@EMPanisset reported a problem (#358) with evbuffer_remove_buffer(), but
actually I think that the problem is in evbuffer_add_buffer() which introduces
this empty chain, all other callers (except evbuffer_prepend_buffer(), but it
doesn't have this problem though) should be safe.

And FWIW the only API that allows empty chains is evbuffer_add_reference(), and
we can add check there to avoid such issues, but for now I leaved this without
fixing, since I think that evbuffer_add_reference() with empty chains can be
used as a barrier (but this can be tricky).

Fixes: regress evbuffer/remove_buffer_with_empty2
v2: introduce/fixes evbuffer/add_buffer_with_empty

8 years agotest/buffer: evbuffer_add_buffer() with empty chains
Azat Khuzhin [Fri, 17 Jun 2016 12:54:53 +0000 (15:54 +0300)]
test/buffer: evbuffer_add_buffer() with empty chains

Reported-by: @EMPanisset
Link: https://github.com/libevent/libevent/issues/358#issuecomment-225345697
8 years agotest/buffer: evbuffer_remove_buffer() with empty chains (prepend)
Azat Khuzhin [Wed, 8 Jun 2016 10:41:30 +0000 (13:41 +0300)]
test/buffer: evbuffer_remove_buffer() with empty chains (prepend)

Using:
- evbuffer_add()
- evbuffer_prepend_buffer()
- evbuffer_add_reference()
- evbuffer_remove_buffer()

8 years agotest/buffer: evbuffer_remove_buffer() with empty chains (evbuffer_add_buffer())
Azat Khuzhin [Tue, 7 Jun 2016 11:56:32 +0000 (14:56 +0300)]
test/buffer: evbuffer_remove_buffer() with empty chains (evbuffer_add_buffer())

Using:
- evbuffer_add()
- evbuffer_add_buffer() -- the one that has problem
- evbuffer_add_reference() -- the only one that allows empty chains to be added
- evbuffer_remove_buffer()

8 years agotest/http: avoid using conditionals with omitted operands (fixes VS2015)
Azat Khuzhin [Fri, 17 Jun 2016 13:14:02 +0000 (16:14 +0300)]
test/http: avoid using conditionals with omitted operands (fixes VS2015)

But we need to add VS2015 build on appveyor.

Fixes: #361
Reported-by: @nntrab
8 years agotest/http: don't mix declarations and code (fixes -Wdeclaration-after-statement)
Azat Khuzhin [Fri, 17 Jun 2016 13:07:15 +0000 (16:07 +0300)]
test/http: don't mix declarations and code (fixes -Wdeclaration-after-statement)

8 years agotest/buffer: fix leak in test_evbuffer_prepend()
Azat Khuzhin [Fri, 17 Jun 2016 12:54:31 +0000 (15:54 +0300)]
test/buffer: fix leak in test_evbuffer_prepend()

8 years agotest/buffer: avoid errors with --no-fork (reinitialize static vars)
Azat Khuzhin [Fri, 17 Jun 2016 12:43:26 +0000 (15:43 +0300)]
test/buffer: avoid errors with --no-fork (reinitialize static vars)

8 years agoFor non GCC/clang on OSX the -Wno-deprecated-declarations may not be valid
Rainer Keller [Mon, 30 May 2016 14:53:41 +0000 (16:53 +0200)]
For non GCC/clang on OSX the -Wno-deprecated-declarations may not be valid

Closes: nmathewson/Libevent#129
8 years agoMerge branch 'travis-ci-os-matrix-v2'
Azat Khuzhin [Wed, 11 May 2016 21:40:25 +0000 (00:40 +0300)]
Merge branch 'travis-ci-os-matrix-v2'

This increases libevent coverage to:
- os:osx

- cmake -DEVENT__DISABLE_MM_REPLACEMENT=ON
- cmake -DEVENT__ENABLE_VERBOSE_DEBUG=ON
- configure --disable-openssl
- configure --disable-thread-support
- configure --disable-malloc-replacement

- fix travis-ci builds under automake >1.11

Possible failures after this patch set (not always, IOW in some builds this
issues aren't real issues):
- some failures but mostly because of timing issues, must be fixed separately.
- https://travis-ci.org/azat/libevent/jobs/129430229 # on brew update
- https://travis-ci.org/azat/libevent/jobs/129430221 # some locking issues

* travis-ci-os-matrix-v2:
  automake: define serial-tests only if automake have this option
  test/automake: don't use paralell test harness (since automake 1.12)
  travis-ci/osx: relink gcc/g++ instead of clang
  travis-ci: enable multi-os mode (osx, linux)
  travis-ci: increase matrix (--disable-foo)
  travis-ci: adjust alignment

Fixes: #356
Travis-CI: https://travis-ci.org/azat/libevent/builds/129430181

8 years agoautomake: define serial-tests only if automake have this option
Azat Khuzhin [Wed, 11 May 2016 13:02:02 +0000 (16:02 +0300)]
automake: define serial-tests only if automake have this option

P.S. I did try a lot of other ways, but seems that this is the only one that
will work.

Fixes: automake 1.11
Travis-CI: https://travis-ci.org/azat/libevent/jobs/129398265

8 years agotest/automake: don't use paralell test harness (since automake 1.12)
Azat Khuzhin [Wed, 11 May 2016 07:18:25 +0000 (10:18 +0300)]
test/automake: don't use paralell test harness (since automake 1.12)

Starting from automake 1.2 there is parallel test harness, that redirects all
output to some log, which serial-test doesn't do.
So in case of new runner we can get no output for 10 minutes, for example on my
desktop:
  $ time make verify VERBOSE=1
  PASS: test/test-script.sh
  ============================================================================
  Testsuite summary for libevent 2.1.5-beta
  ============================================================================
  # TOTAL: 1
  # PASS:  1
  # SKIP:  0
  # XFAIL: 0
  # FAIL:  0
  # XPASS: 0
  # ERROR: 0
  ============================================================================

  real    25m31.735s
  user    0m13.753s
  sys     0m7.648s

And this means that this will fail on travis-ci, since it has timeout for 10
minutes. Sure we can use `travis wait 60` instead, but I think that it is
better to fix this by writing result to output, instead of hacking around, so
let's use serial-tests instead of parallel always.
And now it works on travis-ci under linux because it has automake 1.11 while
osx has at least 1.12.

Links:
https://docs.travis-ci.com/user/common-build-problems/
https://www.gnu.org/software/automake/manual/html_node/Serial-Test-Harness.html#Serial-Test-Harness
https://www.gnu.org/software/automake/manual/html_node/Parallel-Test-Harness.html

CI:
https://travis-ci.org/azat/libevent/jobs/129171497 # ok on linux
https://travis-ci.org/azat/libevent/jobs/129171532 # no output for 10 min on osx

8 years agotravis-ci/osx: relink gcc/g++ instead of clang
Azat Khuzhin [Tue, 10 May 2016 07:25:05 +0000 (10:25 +0300)]
travis-ci/osx: relink gcc/g++ instead of clang

Since by default osx replaces /usr/bin/gcc with it's apple clang, while we have
gcc in our build matrix, so use real gcc.

8 years agotravis-ci: enable multi-os mode (osx, linux)
Azat Khuzhin [Mon, 9 May 2016 15:14:31 +0000 (18:14 +0300)]
travis-ci: enable multi-os mode (osx, linux)

- use addons.apt.packages instead of `apt-get install`
- add `brew update`/`brew install ...`

Link: https://docs.travis-ci.com/user/installing-dependencies/
Link: https://docs.travis-ci.com/user/multi-os/