aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2019-08-01 17:46:13 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-08-01 17:46:13 -0700
commit09ed48167cf81c0f1afef27c5f88de123ad4f90e (patch)
tree11757ef184106ed6620caa712f103d75f8c32f42
parentfdec7c6c5971a78bb6eaf644d921ba6093d86495 (diff)
parentb13aec357818fa496ab59483f08b14241527d840 (diff)
downloadlibevent-09ed48167cf81c0f1afef27c5f88de123ad4f90e.tar.gz
Upgrade libevent to release-2.1.11-stable am: 45729099ea am: d685c97977
am: b13aec3578 Change-Id: I21b9b6aa8ca633fe3998550b5a7807a310bd6105
-rw-r--r--CMakeLists.txt46
-rw-r--r--ChangeLog48
-rw-r--r--METADATA8
-rw-r--r--Makefile.am10
-rw-r--r--Makefile.in151
-rw-r--r--README.md469
-rw-r--r--WIN32-Code/nmake/event2/event-config.h4
-rw-r--r--arc4random.c1
-rw-r--r--buffer.c7
-rw-r--r--buffer_iocp.c1
-rw-r--r--bufferevent_async.c1
-rw-r--r--cmake/AddEventLibrary.cmake54
-rw-r--r--cmake/VersionViaGit.cmake4
-rwxr-xr-xconfigure24
-rw-r--r--configure.ac6
-rw-r--r--evdns.c31
-rw-r--r--event.c24
-rw-r--r--evutil.c11
-rw-r--r--include/event2/buffer_compat.h3
-rw-r--r--include/event2/bufferevent.h8
-rw-r--r--include/event2/dns.h3
-rw-r--r--include/event2/event.h6
-rw-r--r--include/event2/event_struct.h2
-rw-r--r--include/include.am7
-rw-r--r--listener.c1
-rw-r--r--m4/libevent_openssl.m42
-rw-r--r--minheap-internal.h54
-rw-r--r--sample/https-client.c2
-rw-r--r--test/regress_buffer.c12
-rw-r--r--test/regress_dns.c23
-rw-r--r--util-internal.h20
31 files changed, 859 insertions, 184 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6e91c08..70acb69 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -84,7 +84,14 @@ set(EVENT_ABI_LIBVERSION
set(EVENT_PACKAGE_VERSION
"${EVENT_VERSION_MAJOR}.${EVENT_VERSION_MINOR}.${EVENT_VERSION_PATCH}")
-set(EVENT_NUMERIC_VERSION 0x02010a00)
+set(EVENT_NUMERIC_VERSION 0x02010b00)
+# equals to VERSION_INFO in Makefile.am
+set(EVENT_ABI_LIBVERSION_CURRENT 7)
+set(EVENT_ABI_LIBVERSION_REVISION 0)
+set(EVENT_ABI_LIBVERSION_AGE 0)
+
+# equals to RELEASE in Makefile.am
+set(EVENT_PACKAGE_RELEASE 2.1)
# only a subset of names can be used, defaults to "beta"
set(EVENT_STAGE_NAME ${EVENT_VERSION_STAGE})
@@ -322,7 +329,7 @@ endif()
# Winsock.
if(WIN32)
set(CMAKE_EXTRA_INCLUDE_FILES winsock2.h ws2tcpip.h)
- set(CMAKE_REQUIRED_LIBRARIES ws2_32.lib)
+ set(CMAKE_REQUIRED_LIBRARIES ws2_32.lib shell32.lib advapi32.lib)
set(CMAKE_REQUIRED_DEFINITIONS -FIwinsock2.h -FIws2tcpip.h)
endif()
if (SOLARIS)
@@ -337,6 +344,10 @@ if (NOT DEFINED _GNU_SOURCE)
unset(_GNU_SOURCE CACHE)
CHECK_SYMBOL_EXISTS(_GNU_SOURCE "features.h" _GNU_SOURCE)
endif()
+
+ if (ANDROID)
+ set(_GNU_SOURCE TRUE)
+ endif()
endif()
if (_GNU_SOURCE)
@@ -626,7 +637,7 @@ CHECK_TYPE_SIZE("time_t" EVENT__SIZEOF_TIME_T)
# Verify kqueue works with pipes.
if (EVENT__HAVE_KQUEUE)
- if (CMAKE_CROSSCOMPILING AND NOT EVENT__FORCE_KQUEUE_CHECK)
+ if ((CMAKE_CROSSCOMPILING OR APPLE) AND NOT EVENT__FORCE_KQUEUE_CHECK)
message(WARNING "Cannot check if kqueue works with pipes when crosscompiling, use EVENT__FORCE_KQUEUE_CHECK to be sure (this requires manually running a test program on the cross compilation target)")
set(EVENT__HAVE_WORKING_KQUEUE 1)
else()
@@ -873,7 +884,7 @@ if(WIN32)
list(APPEND HDR_PRIVATE WIN32-Code/getopt.h)
set(EVENT__DNS_USE_FTIME_FOR_ID 1)
- set(LIB_PLATFORM ws2_32)
+ set(LIB_PLATFORM ws2_32 shell32 advapi32)
add_definitions(
-D_CRT_SECURE_NO_WARNINGS
-D_CRT_NONSTDC_NO_DEPRECATE)
@@ -1465,6 +1476,33 @@ install(EXPORT LibeventTargets
DESTINATION "${DEF_INSTALL_CMAKE_DIR}"
COMPONENT dev)
+# Install the scripts.
+install(PROGRAMS
+ ${CMAKE_CURRENT_SOURCE_DIR}/event_rpcgen.py
+ DESTINATION "bin"
+ COMPONENT runtime)
+
+# Create documents with doxygen.
+find_program(DOXYGEN doxygen)
+if (DOXYGEN)
+ add_custom_target(doxygen
+ COMMAND ${DOXYGEN} Doxyfile
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+else()
+ message(WARNING "The doxygen target will not support since doxygen command was not found!")
+endif()
+
+
+# Create the uninstall target.
+# https://gitlab.kitware.com/cmake/community/wikis/FAQ#can-i-do-make-uninstall-with-cmake
+configure_file(${PROJECT_SOURCE_DIR}/cmake/Uninstall.cmake.in
+ ${PROJECT_BINARY_DIR}/Uninstall.cmake
+ @ONLY)
+
+add_custom_target(uninstall
+ COMMAND ${CMAKE_COMMAND} -P ${PROJECT_BINARY_DIR}/Uninstall.cmake)
+
+
message(STATUS "")
message(STATUS " ---( Libevent " ${EVENT_VERSION} " )---")
message(STATUS "")
diff --git a/ChangeLog b/ChangeLog
index 1cc6007..e89d5a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,49 @@
+Changes in version 2.1.11-stable (01 Aug 2019)
+
+ This release contains one ABI breakage fix (that had been introduced in
+ 2.1.10, and strictly speaking this release breaks ABI again to make it
+ compatible with 2.1.9 and less, please take a look at 18104973 for more
+ details). Apart from that it contains some bug fixes, that grouped below.
+
+ And even though the return value for evbuffer_setcb() had been changed it
+ should ABI compatible (anyway that function is in -compat.h header).
+
+ There is also one patch that introduce new functionality, this is 546a366c,
+ to tune SO_RCVBUF/SO_SNDBUF in evdns, but one can count it as a bug-fix on
+ the application level, since before you cannot tune this settings and hence
+ you could stumble on problems.
+
+ ABI breakage:
+ o Protect min_heap_push_ against integer overflow. (8c899768 Tobias Stoeckmann)
+ o Revert "Protect min_heap_push_ against integer overflow." (18104973 Azat Khuzhin)
+
+ functionality:
+ o evdns: add new options -- so-rcvbuf/so-sndbuf (546a366c Azat Khuzhin)
+
+ build:
+ o Change autoconf version to 2.62 and automake version to 1.11.2 (2a333008 yuangongji)
+ o cmake: install shared library only if it was requested (596855f7 Azat Khuzhin)
+ o Missing <winerror.h> on win7/MinGW(MINGW32_NT-6.1)/MSYS (9559349c yuangongji)
+ o cmake: set library names to be the same as with autotools (305251b9 yuangongji)
+ o Enable _GNU_SOURCE for Android (f013fc7d Keith Smiley)
+ o Enable kqueue for APPLE targets (3aa68a82 Keith Smiley)
+ o autotools: do not install bufferevent_ssl.h under --disable-openssl (5349a07e Azat Khuzhin)
+ o cmake: link against shell32.lib/advapi32.lib (c9ce638c Azat Khuzhin)
+ o Add README.md into dist archive (3660a4cc Azat Khuzhin)
+ o cmake: add missing autotools targets (doxygen, uninstall, event_rpcgen.py) (2d65071c yuangongji)
+ o m4/libevent_openssl.m4: fix detection of openssl (d4056e59 Fabrice Fontaine)
+ o Fix detection of the __has_attribute() for apple clang [ci skip] (7fd7c5ef Azat Khuzhin)
+
+ lib:
+ o buffer: fix possible NULL dereference in evbuffer_setcb() on ENOMEM (598f247d Azat Khuzhin)
+ o Warn if forked from the event loop during event_reinit() (b75922ae Azat Khuzhin)
+ o evutil: set the have_checked_interfaces in evutil_check_interfaces()
+ (ef498aa2, a09265ac jeremyerb)
+
+ samples:
+ o https-client: correction error checking (a8a04565 wenyg)
+
+
Changes in version 2.1.10-stable (26 May 2019)
This release contains mostly fixes (some evbuffer oddity, AF_UNIX handling in
@@ -9,7 +55,7 @@ Changes in version 2.1.10-stable (26 May 2019)
trivial fixes pruned out from it - to make it a little bit more informative).
To view full changelog please use git:
- git log --format=' o %s (%h %aN)' release-2.1.8-stable...release-2.1.9-beta
+ git log --format=' o %s (%h %aN)' release-2.1.9-beta...release-2.1.10-stable
dist:
o Add getopt into dist archive (7042ff24 Azat Khuzhin)
diff --git a/METADATA b/METADATA
index 422cc63..d9738a9 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://github.com/libevent/libevent/releases/download/release-2.1.10-stable/libevent-2.1.10-stable.tar.gz"
+ value: "https://github.com/libevent/libevent/releases/download/release-2.1.11-stable/libevent-2.1.11-stable.tar.gz"
}
- version: "release-2.1.10-stable"
+ version: "release-2.1.11-stable"
license_type: RECIPROCAL
last_upgrade_date {
year: 2019
- month: 5
- day: 31
+ month: 8
+ day: 1
}
}
diff --git a/Makefile.am b/Makefile.am
index 240d014..dd90502 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,8 +5,8 @@
# See LICENSE for copying information.
# 'foreign' means that we're not enforcing GNU package rules strictly.
-# '1.9' means that we need automake 1.9 or later (and we do).
-AUTOMAKE_OPTIONS = foreign 1.9 subdir-objects
+# '1.11.2' means that we need automake 1.11.2 or later (and we do).
+AUTOMAKE_OPTIONS = foreign 1.11.2 subdir-objects
ACLOCAL_AMFLAGS = -I m4
@@ -38,7 +38,7 @@ RELEASE = -release 2.1
#
# Once an RC is out, DO NOT MAKE ANY ABI-BREAKING CHANGES IN THAT SERIES
# UNLESS YOU REALLY REALLY HAVE TO.
-VERSION_INFO = 6:4:0
+VERSION_INFO = 7:0:0
# History: RELEASE VERSION_INFO
# 2.0.1-alpha -- 2.0 1:0:0
@@ -73,7 +73,8 @@ VERSION_INFO = 6:4:0
# 2.1.7-beta -- 2.1 6:1:0 (ABI changed slightly)
# 2.1.8-stable-- 2.1 6:2:0 (No ABI change)
# 2.1.9-beta-- 2.1 6:3:0 (No ABI change)
-# 2.1.10-stable-- 2.1 6:4:0 (No ABI change)
+# 2.1.10-stable-- 2.1 6:4:0 (No ABI change, WRONG)
+# 2.1.11-stable-- 2.1 7:0:0 (ABI changed)
# ABI version history for this package effectively restarts every time
# we change RELEASE. Version 1.4.x had RELEASE of 1.4.
@@ -142,6 +143,7 @@ EXTRA_DIST = \
make-event-config.sed \
whatsnew-2.0.txt \
whatsnew-2.1.txt \
+ README.md \
$(CMAKE_FILES) \
$(PLATFORM_DEPENDENT_SRC)
diff --git a/Makefile.in b/Makefile.in
index 8c51f38..9f4b477 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -20,7 +20,7 @@
#
# See LICENSE for copying information.
-# include/Makefile.am for libevent
+# include/include.am for libevent
# Copyright 2000-2007 Niels Provos
# Copyright 2007-2012 Niels Provos and Nick Mathewson
#
@@ -122,31 +122,32 @@ host_triplet = @host@
@OPENSSL_TRUE@am__append_4 = libevent_openssl.pc
noinst_PROGRAMS = $(am__EXEEXT_4) $(am__EXEEXT_6)
EXTRA_PROGRAMS = $(am__EXEEXT_1)
-@INSTALL_LIBEVENT_FALSE@am__append_5 = $(EVENT2_EXPORT)
-@OPENSSL_TRUE@am__append_6 = sample/le-proxy sample/https-client
-@OPENSSL_TRUE@am__append_7 = \
+@OPENSSL_TRUE@am__append_5 = include/event2/bufferevent_ssl.h
+@INSTALL_LIBEVENT_FALSE@am__append_6 = $(EVENT2_EXPORT)
+@OPENSSL_TRUE@am__append_7 = sample/le-proxy sample/https-client
+@OPENSSL_TRUE@am__append_8 = \
@OPENSSL_TRUE@ sample/hostcheck.h \
@OPENSSL_TRUE@ sample/openssl_hostname_validation.h
-@BUILD_SAMPLES_TRUE@am__append_8 = $(SAMPLES)
-@BUILD_REGRESS_TRUE@am__append_9 = $(TESTPROGRAMS)
-@BUILD_REGRESS_TRUE@am__append_10 = test/regress
-@BUILD_REGRESS_TRUE@am__append_11 = test/regress.gen.c test/regress.gen.h
-@PTHREADS_TRUE@am__append_12 = libevent_pthreads.la
-@BUILD_WIN32_TRUE@am__append_13 = test/regress_iocp.c
-@OPENSSL_TRUE@am__append_14 = test/regress_ssl.c
-@OPENSSL_TRUE@am__append_15 = $(OPENSSL_INCS)
-@OPENSSL_TRUE@am__append_16 = libevent_openssl.la $(OPENSSL_LIBS) ${OPENSSL_LIBADD}
-@BUILD_WIN32_TRUE@@THREADS_TRUE@am__append_17 = evthread_win32.c
-@STRLCPY_IMPL_TRUE@am__append_18 = strlcpy.c
-@SELECT_BACKEND_TRUE@am__append_19 = select.c
-@POLL_BACKEND_TRUE@am__append_20 = poll.c
-@DEVPOLL_BACKEND_TRUE@am__append_21 = devpoll.c
-@KQUEUE_BACKEND_TRUE@am__append_22 = kqueue.c
-@EPOLL_BACKEND_TRUE@am__append_23 = epoll.c
-@EVPORT_BACKEND_TRUE@am__append_24 = evport.c
-@SIGNAL_SUPPORT_TRUE@am__append_25 = signal.c
-@INSTALL_LIBEVENT_FALSE@am__append_26 = $(EVENT1_HDRS)
+@BUILD_SAMPLES_TRUE@am__append_9 = $(SAMPLES)
+@BUILD_REGRESS_TRUE@am__append_10 = $(TESTPROGRAMS)
+@BUILD_REGRESS_TRUE@am__append_11 = test/regress
+@BUILD_REGRESS_TRUE@am__append_12 = test/regress.gen.c test/regress.gen.h
+@PTHREADS_TRUE@am__append_13 = libevent_pthreads.la
+@BUILD_WIN32_TRUE@am__append_14 = test/regress_iocp.c
+@OPENSSL_TRUE@am__append_15 = test/regress_ssl.c
+@OPENSSL_TRUE@am__append_16 = $(OPENSSL_INCS)
+@OPENSSL_TRUE@am__append_17 = libevent_openssl.la $(OPENSSL_LIBS) ${OPENSSL_LIBADD}
+@BUILD_WIN32_TRUE@@THREADS_TRUE@am__append_18 = evthread_win32.c
+@STRLCPY_IMPL_TRUE@am__append_19 = strlcpy.c
+@SELECT_BACKEND_TRUE@am__append_20 = select.c
+@POLL_BACKEND_TRUE@am__append_21 = poll.c
+@DEVPOLL_BACKEND_TRUE@am__append_22 = devpoll.c
+@KQUEUE_BACKEND_TRUE@am__append_23 = kqueue.c
+@EPOLL_BACKEND_TRUE@am__append_24 = epoll.c
+@EVPORT_BACKEND_TRUE@am__append_25 = evport.c
+@SIGNAL_SUPPORT_TRUE@am__append_26 = signal.c
+@INSTALL_LIBEVENT_FALSE@am__append_27 = $(EVENT1_HDRS)
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_backport_259_ssizet.m4 \
@@ -403,7 +404,7 @@ am_test_regress_OBJECTS = test/regress-regress.$(OBJEXT) \
test/regress-tinytest.$(OBJEXT) $(am__objects_13) \
$(am__objects_14) $(am__objects_15) $(am__objects_16)
test_regress_OBJECTS = $(am_test_regress_OBJECTS)
-am__DEPENDENCIES_3 = $(am__append_12)
+am__DEPENDENCIES_3 = $(am__append_13)
@OPENSSL_TRUE@am__DEPENDENCIES_4 = libevent_openssl.la \
@OPENSSL_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
test_regress_DEPENDENCIES = $(am__DEPENDENCIES_1) libevent_core.la \
@@ -578,7 +579,6 @@ am__include_HEADERS_DIST = include/evdns.h include/event.h \
am__include_event2_HEADERS_DIST = include/event2/buffer.h \
include/event2/buffer_compat.h include/event2/bufferevent.h \
include/event2/bufferevent_compat.h \
- include/event2/bufferevent_ssl.h \
include/event2/bufferevent_struct.h include/event2/dns.h \
include/event2/dns_compat.h include/event2/dns_struct.h \
include/event2/event.h include/event2/event_compat.h \
@@ -588,11 +588,11 @@ am__include_event2_HEADERS_DIST = include/event2/buffer.h \
include/event2/rpc.h include/event2/rpc_compat.h \
include/event2/rpc_struct.h include/event2/tag.h \
include/event2/tag_compat.h include/event2/thread.h \
- include/event2/util.h include/event2/visibility.h
+ include/event2/util.h include/event2/visibility.h \
+ include/event2/bufferevent_ssl.h
am__noinst_HEADERS_DIST = include/event2/buffer.h \
include/event2/buffer_compat.h include/event2/bufferevent.h \
include/event2/bufferevent_compat.h \
- include/event2/bufferevent_ssl.h \
include/event2/bufferevent_struct.h include/event2/dns.h \
include/event2/dns_compat.h include/event2/dns_struct.h \
include/event2/event.h include/event2/event_compat.h \
@@ -603,10 +603,10 @@ am__noinst_HEADERS_DIST = include/event2/buffer.h \
include/event2/rpc_struct.h include/event2/tag.h \
include/event2/tag_compat.h include/event2/thread.h \
include/event2/util.h include/event2/visibility.h \
- sample/hostcheck.h sample/openssl_hostname_validation.h \
- test/regress.h test/regress_thread.h test/tinytest.h \
- test/tinytest_local.h test/tinytest_macros.h \
- WIN32-Code/nmake/evconfig-private.h \
+ include/event2/bufferevent_ssl.h sample/hostcheck.h \
+ sample/openssl_hostname_validation.h test/regress.h \
+ test/regress_thread.h test/tinytest.h test/tinytest_local.h \
+ test/tinytest_macros.h WIN32-Code/nmake/evconfig-private.h \
WIN32-Code/nmake/event2/event-config.h WIN32-Code/getopt.h \
WIN32-Code/getopt.c WIN32-Code/getopt_long.c WIN32-Code/tree.h \
bufferevent-internal.h changelist-internal.h \
@@ -913,7 +913,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
-PTHREAD_LIBS = @PTHREAD_LIBS@ $(am__append_12)
+PTHREAD_LIBS = @PTHREAD_LIBS@ $(am__append_13)
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
@@ -976,8 +976,8 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
# 'foreign' means that we're not enforcing GNU package rules strictly.
-# '1.9' means that we need automake 1.9 or later (and we do).
-AUTOMAKE_OPTIONS = foreign 1.9 subdir-objects
+# '1.11.2' means that we need automake 1.11.2 or later (and we do).
+AUTOMAKE_OPTIONS = foreign 1.11.2 subdir-objects
ACLOCAL_AMFLAGS = -I m4
# This is the "Release" of the Libevent ABI. It takes precedence over
@@ -1008,7 +1008,7 @@ RELEASE = -release 2.1
#
# Once an RC is out, DO NOT MAKE ANY ABI-BREAKING CHANGES IN THAT SERIES
# UNLESS YOU REALLY REALLY HAVE TO.
-VERSION_INFO = 6:4:0
+VERSION_INFO = 7:0:0
# History: RELEASE VERSION_INFO
# 2.0.1-alpha -- 2.0 1:0:0
@@ -1043,7 +1043,8 @@ VERSION_INFO = 6:4:0
# 2.1.7-beta -- 2.1 6:1:0 (ABI changed slightly)
# 2.1.8-stable-- 2.1 6:2:0 (No ABI change)
# 2.1.9-beta-- 2.1 6:3:0 (No ABI change)
-# 2.1.10-stable-- 2.1 6:4:0 (No ABI change)
+# 2.1.10-stable-- 2.1 6:4:0 (No ABI change, WRONG)
+# 2.1.11-stable-- 2.1 7:0:0 (ABI changed)
# ABI version history for this package effectively restarts every time
# we change RELEASE. Version 1.4.x had RELEASE of 1.4.
@@ -1100,17 +1101,18 @@ CMAKE_FILES = \
EXTRA_DIST = ChangeLog-1.4 ChangeLog-2.0 Doxyfile LICENSE \
Makefile.nmake test/Makefile.nmake autogen.sh event_rpcgen.py \
libevent.pc.in make-event-config.sed whatsnew-2.0.txt \
- whatsnew-2.1.txt $(CMAKE_FILES) $(PLATFORM_DEPENDENT_SRC) \
- test/check-dumpevents.py test/regress.gen.c test/regress.gen.h \
- test/regress.rpc test/rpcgen_wrapper.sh \
- test/print-winsock-errors.c test/test.sh
+ whatsnew-2.1.txt README.md $(CMAKE_FILES) \
+ $(PLATFORM_DEPENDENT_SRC) test/check-dumpevents.py \
+ test/regress.gen.c test/regress.gen.h test/regress.rpc \
+ test/rpcgen_wrapper.sh test/print-winsock-errors.c \
+ test/test.sh
LIBEVENT_LIBS_LA = libevent.la libevent_core.la libevent_extra.la \
$(am__append_1) $(am__append_3)
@INSTALL_LIBEVENT_TRUE@lib_LTLIBRARIES = $(LIBEVENT_LIBS_LA)
@INSTALL_LIBEVENT_TRUE@pkgconfig_DATA = $(LIBEVENT_PKGCONFIG)
@INSTALL_LIBEVENT_FALSE@noinst_LTLIBRARIES = $(LIBEVENT_LIBS_LA)
EXTRA_SOURCE =
-noinst_HEADERS = $(am__append_5) $(am__append_7) test/regress.h \
+noinst_HEADERS = $(am__append_6) $(am__append_8) test/regress.h \
test/regress_thread.h test/tinytest.h test/tinytest_local.h \
test/tinytest_macros.h WIN32-Code/nmake/evconfig-private.h \
WIN32-Code/nmake/event2/event-config.h WIN32-Code/getopt.h \
@@ -1123,46 +1125,33 @@ noinst_HEADERS = $(am__append_5) $(am__append_7) test/regress.h \
kqueue-internal.h log-internal.h minheap-internal.h \
mm-internal.h ratelim-internal.h ratelim-internal.h \
strlcpy-internal.h time-internal.h util-internal.h \
- openssl-compat.h $(am__append_26)
+ openssl-compat.h $(am__append_27)
CLEANFILES = test/rpcgen-attempted
DISTCLEANFILES = test/regress.gen.c test/regress.gen.h *~ libevent.pc \
libevent_core.pc libevent_extra.pc \
./include/event2/event-config.h
-BUILT_SOURCES = $(am__append_11) include/event2/event-config.h
+BUILT_SOURCES = $(am__append_12) include/event2/event-config.h
include_event2dir = $(includedir)/event2
-EVENT2_EXPORT = \
- include/event2/buffer.h \
- include/event2/buffer_compat.h \
+EVENT2_EXPORT = include/event2/buffer.h include/event2/buffer_compat.h \
include/event2/bufferevent.h \
include/event2/bufferevent_compat.h \
- include/event2/bufferevent_ssl.h \
- include/event2/bufferevent_struct.h \
- include/event2/dns.h \
- include/event2/dns_compat.h \
- include/event2/dns_struct.h \
- include/event2/event.h \
- include/event2/event_compat.h \
- include/event2/event_struct.h \
- include/event2/http.h \
- include/event2/http_compat.h \
- include/event2/http_struct.h \
- include/event2/keyvalq_struct.h \
- include/event2/listener.h \
- include/event2/rpc.h \
- include/event2/rpc_compat.h \
- include/event2/rpc_struct.h \
- include/event2/tag.h \
- include/event2/tag_compat.h \
- include/event2/thread.h \
- include/event2/util.h \
- include/event2/visibility.h
-
+ include/event2/bufferevent_struct.h include/event2/dns.h \
+ include/event2/dns_compat.h include/event2/dns_struct.h \
+ include/event2/event.h include/event2/event_compat.h \
+ include/event2/event_struct.h include/event2/http.h \
+ include/event2/http_compat.h include/event2/http_struct.h \
+ include/event2/keyvalq_struct.h include/event2/listener.h \
+ include/event2/rpc.h include/event2/rpc_compat.h \
+ include/event2/rpc_struct.h include/event2/tag.h \
+ include/event2/tag_compat.h include/event2/thread.h \
+ include/event2/util.h include/event2/visibility.h \
+ $(am__append_5)
@INSTALL_LIBEVENT_TRUE@include_event2_HEADERS = $(EVENT2_EXPORT)
@INSTALL_LIBEVENT_TRUE@nodist_include_event2_HEADERS = include/event2/event-config.h
@INSTALL_LIBEVENT_FALSE@nodist_noinst_HEADERS = include/event2/event-config.h
SAMPLES = sample/dns-example sample/event-read-fifo sample/hello-world \
sample/http-server sample/http-connect sample/signal-test \
- sample/time-test $(am__append_6)
+ sample/time-test $(am__append_7)
@OPENSSL_TRUE@sample_le_proxy_SOURCES = sample/le-proxy.c
@OPENSSL_TRUE@sample_le_proxy_LDADD = libevent.la libevent_openssl.la $(OPENSSL_LIBS) $(OPENSSL_LIBADD)
@OPENSSL_TRUE@sample_le_proxy_CPPFLAGS = $(AM_CPPFLAGS) $(OPENSSL_INCS)
@@ -1244,15 +1233,15 @@ test_regress_SOURCES = test/regress.c test/regress.gen.c \
test/regress_minheap.c test/regress_rpc.c \
test/regress_testutils.c test/regress_testutils.h \
test/regress_util.c test/tinytest.c $(regress_thread_SOURCES) \
- $(regress_zlib_SOURCES) $(am__append_13) $(am__append_14)
+ $(regress_zlib_SOURCES) $(am__append_14) $(am__append_15)
@BUILD_WIN32_TRUE@@THREADS_TRUE@regress_thread_SOURCES = test/regress_thread.c
@PTHREADS_TRUE@regress_thread_SOURCES = test/regress_thread.c
@ZLIB_REGRESS_TRUE@regress_zlib_SOURCES = test/regress_zlib.c
test_regress_LDADD = $(LIBEVENT_GC_SECTIONS) libevent_core.la \
libevent_extra.la $(PTHREAD_LIBS) $(ZLIB_LIBS) \
- $(am__append_16)
+ $(am__append_17)
test_regress_CPPFLAGS = $(AM_CPPFLAGS) $(PTHREAD_CFLAGS) \
- $(ZLIB_CFLAGS) -Itest $(am__append_15)
+ $(ZLIB_CFLAGS) -Itest $(am__append_16)
test_regress_LDFLAGS = $(PTHREAD_CFLAGS)
test_bench_SOURCES = test/bench.c
test_bench_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la
@@ -1264,16 +1253,16 @@ test_bench_httpclient_SOURCES = test/bench_httpclient.c
test_bench_httpclient_LDADD = $(LIBEVENT_GC_SECTIONS) libevent_core.la
@BUILD_WIN32_FALSE@SYS_LIBS =
@BUILD_WIN32_TRUE@SYS_LIBS = -lws2_32 -lshell32 -ladvapi32
-@BUILD_WIN32_FALSE@SYS_SRC = $(am__append_18) $(am__append_19) \
-@BUILD_WIN32_FALSE@ $(am__append_20) $(am__append_21) \
-@BUILD_WIN32_FALSE@ $(am__append_22) $(am__append_23) \
-@BUILD_WIN32_FALSE@ $(am__append_24) $(am__append_25)
+@BUILD_WIN32_FALSE@SYS_SRC = $(am__append_19) $(am__append_20) \
+@BUILD_WIN32_FALSE@ $(am__append_21) $(am__append_22) \
+@BUILD_WIN32_FALSE@ $(am__append_23) $(am__append_24) \
+@BUILD_WIN32_FALSE@ $(am__append_25) $(am__append_26)
@BUILD_WIN32_TRUE@SYS_SRC = win32select.c buffer_iocp.c event_iocp.c \
-@BUILD_WIN32_TRUE@ bufferevent_async.c $(am__append_17) \
-@BUILD_WIN32_TRUE@ $(am__append_18) $(am__append_19) \
-@BUILD_WIN32_TRUE@ $(am__append_20) $(am__append_21) \
-@BUILD_WIN32_TRUE@ $(am__append_22) $(am__append_23) \
-@BUILD_WIN32_TRUE@ $(am__append_24) $(am__append_25)
+@BUILD_WIN32_TRUE@ bufferevent_async.c $(am__append_18) \
+@BUILD_WIN32_TRUE@ $(am__append_19) $(am__append_20) \
+@BUILD_WIN32_TRUE@ $(am__append_21) $(am__append_22) \
+@BUILD_WIN32_TRUE@ $(am__append_23) $(am__append_24) \
+@BUILD_WIN32_TRUE@ $(am__append_25) $(am__append_26)
@BUILD_WIN32_FALSE@SYS_INCLUDES =
@BUILD_WIN32_TRUE@SYS_INCLUDES = -IWIN32-Code -IWIN32-Code/nmake
CORE_SRC = \
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..8be37f4
--- /dev/null
+++ b/README.md
@@ -0,0 +1,469 @@
+<p align="center">
+ <img src="https://strcpy.net/libevent3.png" alt="libevent logo"/>
+</p>
+
+
+
+[![Appveyor Win32 Build Status](https://ci.appveyor.com/api/projects/status/ng3jg0uhy44mp7ik?svg=true)](https://ci.appveyor.com/project/libevent/libevent)
+[![Travis Build Status](https://travis-ci.org/libevent/libevent.svg?branch=master)](https://travis-ci.org/libevent/libevent)
+[![Coverage Status](https://coveralls.io/repos/github/libevent/libevent/badge.svg)](https://coveralls.io/github/libevent/libevent)
+[![Join the chat at https://gitter.im/libevent/libevent](https://badges.gitter.im/libevent/libevent.svg)](https://gitter.im/libevent/libevent?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+
+
+
+# 0. BUILDING AND INSTALLATION (Briefly)
+
+## Autoconf
+
+ $ ./configure
+ $ make
+ $ make verify # (optional)
+ $ sudo make install
+
+## CMake (General)
+
+
+The following Libevent specific CMake variables are as follows (the values being
+the default).
+
+```
+# Type of the library to build (SHARED or STATIC)
+# Default is: SHARED for MSVC, otherwise BOTH
+EVENT__LIBRARY_TYPE:STRING=DEFAULT
+
+# Installation directory for CMake files
+EVENT_INSTALL_CMAKE_DIR:PATH=lib/cmake/libevent
+
+# Enable running gcov to get a test coverage report (only works with
+# GCC/CLang). Make sure to enable -DCMAKE_BUILD_TYPE=Debug as well.
+EVENT__COVERAGE:BOOL=OFF
+
+# Defines if Libevent should build without the benchmark executables
+EVENT__DISABLE_BENCHMARK:BOOL=OFF
+
+# Define if Libevent should build without support for a debug mode
+EVENT__DISABLE_DEBUG_MODE:BOOL=OFF
+
+# Define if Libevent should not allow replacing the mm functions
+EVENT__DISABLE_MM_REPLACEMENT:BOOL=OFF
+
+# Define if Libevent should build without support for OpenSSL encryption
+EVENT__DISABLE_OPENSSL:BOOL=OFF
+
+# Disable the regress tests
+EVENT__DISABLE_REGRESS:BOOL=OFF
+
+# Disable sample files
+EVENT__DISABLE_SAMPLES:BOOL=OFF
+
+# If tests should be compiled or not
+EVENT__DISABLE_TESTS:BOOL=OFF
+
+# Define if Libevent should not be compiled with thread support
+EVENT__DISABLE_THREAD_SUPPORT:BOOL=OFF
+
+# Enables verbose debugging
+EVENT__ENABLE_VERBOSE_DEBUG:BOOL=OFF
+
+# When cross compiling, forces running a test program that verifies that Kqueue
+# works with pipes. Note that this requires you to manually run the test program
+# on the the cross compilation target to verify that it works. See CMake
+# documentation for try_run for more details
+EVENT__FORCE_KQUEUE_CHECK:BOOL=OFF
+```
+
+__More variables can be found by running `cmake -LAH <sourcedir_path>`__
+
+
+## CMake (Windows)
+
+Install CMake: <https://www.cmake.org>
+
+
+ $ md build && cd build
+ $ cmake -G "Visual Studio 10" .. # Or whatever generator you want to use cmake --help for a list.
+ $ start libevent.sln
+
+## CMake (Unix)
+
+ $ mkdir build && cd build
+ $ cmake .. # Default to Unix Makefiles.
+ $ make
+ $ make verify # (optional)
+
+
+# 1. BUILDING AND INSTALLATION (In Depth)
+
+## Autoconf
+
+To build Libevent, type
+
+ $ ./configure && make
+
+
+ (If you got Libevent from the git repository, you will
+ first need to run the included "autogen.sh" script in order to
+ generate the configure script.)
+
+You can run the regression tests by running
+
+ $ make verify
+
+Install as root via
+
+ $ make install
+
+Before reporting any problems, please run the regression tests.
+
+To enable low-level tracing, build the library as:
+
+ $ CFLAGS=-DUSE_DEBUG ./configure [...]
+
+Standard configure flags should work. In particular, see:
+
+ --disable-shared Only build static libraries.
+ --prefix Install all files relative to this directory.
+
+
+The configure script also supports the following flags:
+
+ --enable-gcc-warnings Enable extra compiler checking with GCC.
+ --disable-malloc-replacement
+ Don't let applications replace our memory
+ management functions.
+ --disable-openssl Disable support for OpenSSL encryption.
+ --disable-thread-support Don't support multithreaded environments.
+
+## CMake (Windows)
+
+(Note that autoconf is currently the most mature and supported build
+environment for Libevent; the CMake instructions here are new and
+experimental, though they _should_ be solid. We hope that CMake will
+still be supported in future versions of Libevent, and will try to
+make sure that happens.)
+
+First of all install <https://www.cmake.org>.
+
+To build Libevent using Microsoft Visual studio open the "Visual Studio Command prompt" and type:
+
+```
+$ cd <libevent source dir>
+$ mkdir build && cd build
+$ cmake -G "Visual Studio 10" .. # Or whatever generator you want to use cmake --help for a list.
+$ start libevent.sln
+```
+
+In the above, the ".." refers to the dir containing the Libevent source code.
+You can build multiple versions (with different compile time settings) from the same source tree
+by creating other build directories.
+
+It is highly recommended to build "out of source" when using
+CMake instead of "in source" like the normal behaviour of autoconf for this reason.
+
+The "NMake Makefiles" CMake generator can be used to build entirely via the command line.
+
+To get a list of settings available for the project you can type:
+
+```
+$ cmake -LH ..
+```
+
+### GUI
+
+CMake also provides a GUI that lets you specify the source directory and output (binary) directory
+that the build should be placed in.
+
+# 2. USEFUL LINKS:
+
+For the latest released version of Libevent, see the official website at
+<http://libevent.org/> .
+
+There's a pretty good work-in-progress manual up at
+ <http://www.wangafu.net/~nickm/libevent-book/> .
+
+For the latest development versions of Libevent, access our Git repository
+via
+
+```
+$ git clone https://github.com/libevent/libevent.git
+```
+
+You can browse the git repository online at:
+
+<https://github.com/libevent/libevent>
+
+To report bugs, issues, or ask for new features:
+
+__Patches__: https://github.com/libevent/libevent/pulls
+> OK, those are not really _patches_. You fork, modify, and hit the "Create Pull Request" button.
+> You can still submit normal git patches via the mailing list.
+
+__Bugs, Features [RFC], and Issues__: https://github.com/libevent/libevent/issues
+> Or you can do it via the mailing list.
+
+There's also a libevent-users mailing list for talking about Libevent
+use and development:
+
+<http://archives.seul.org/libevent/users/>
+
+# 3. ACKNOWLEDGMENTS
+
+The following people have helped with suggestions, ideas, code or
+fixing bugs:
+
+ * Samy Al Bahra
+ * Antony Antony
+ * Jacob Appelbaum
+ * Arno Bakker
+ * Weston Andros Adamson
+ * William Ahern
+ * Ivan Andropov
+ * Sergey Avseyev
+ * Avi Bab
+ * Joachim Bauch
+ * Andrey Belobrov
+ * Gilad Benjamini
+ * Stas Bekman
+ * Denis Bilenko
+ * Julien Blache
+ * Kevin Bowling
+ * Tomash Brechko
+ * Kelly Brock
+ * Ralph Castain
+ * Adrian Chadd
+ * Lawnstein Chan
+ * Shuo Chen
+ * Ka-Hing Cheung
+ * Andrew Cox
+ * Paul Croome
+ * George Danchev
+ * Andrew Danforth
+ * Ed Day
+ * Christopher Davis
+ * Mike Davis
+ * Frank Denis
+ * Antony Dovgal
+ * Mihai Draghicioiu
+ * Alexander Drozdov
+ * Mark Ellzey
+ * Shie Erlich
+ * Leonid Evdokimov
+ * Juan Pablo Fernandez
+ * Christophe Fillot
+ * Mike Frysinger
+ * Remi Gacogne
+ * Artem Germanov
+ * Alexander von Gernler
+ * Diego Giagio
+ * Artur Grabowski
+ * Diwaker Gupta
+ * Kuldeep Gupta
+ * Sebastian Hahn
+ * Dave Hart
+ * Greg Hazel
+ * Nicholas Heath
+ * Michael Herf
+ * Savg He
+ * Mark Heily
+ * Maxime Henrion
+ * Michael Herf
+ * Greg Hewgill
+ * Andrew Hochhaus
+ * Aaron Hopkins
+ * Tani Hosokawa
+ * Jamie Iles
+ * Xiuqiang Jiang
+ * Claudio Jeker
+ * Evan Jones
+ * Marcin Juszkiewicz
+ * George Kadianakis
+ * Makoto Kato
+ * Phua Keat
+ * Azat Khuzhin
+ * Alexander Klauer
+ * Kevin Ko
+ * Brian Koehmstedt
+ * Marko Kreen
+ * Ondřej Kuzník
+ * Valery Kyholodov
+ * Ross Lagerwall
+ * Scott Lamb
+ * Christopher Layne
+ * Adam Langley
+ * Graham Leggett
+ * Volker Lendecke
+ * Philip Lewis
+ * Zhou Li
+ * David Libenzi
+ * Yan Lin
+ * Moshe Litvin
+ * Simon Liu
+ * Mitchell Livingston
+ * Hagne Mahre
+ * Lubomir Marinov
+ * Abilio Marques
+ * Nicolas Martyanoff
+ * Abel Mathew
+ * Nick Mathewson
+ * James Mansion
+ * Nicholas Marriott
+ * Andrey Matveev
+ * Caitlin Mercer
+ * Dagobert Michelsen
+ * Andrea Montefusco
+ * Mansour Moufid
+ * Mina Naguib
+ * Felix Nawothnig
+ * Trond Norbye
+ * Linus Nordberg
+ * Richard Nyberg
+ * Jon Oberheide
+ * John Ohl
+ * Phil Oleson
+ * Alexey Ozeritsky
+ * Dave Pacheco
+ * Derrick Pallas
+ * Tassilo von Parseval
+ * Catalin Patulea
+ * Patrick Pelletier
+ * Simon Perreault
+ * Dan Petro
+ * Pierre Phaneuf
+ * Amarin Phaosawasdi
+ * Ryan Phillips
+ * Dimitre Piskyulev
+ * Pavel Plesov
+ * Jon Poland
+ * Roman Puls
+ * Nate R
+ * Robert Ransom
+ * Balint Reczey
+ * Bert JW Regeer
+ * Nate Rosenblum
+ * Peter Rosin
+ * Maseeb Abdul Qadir
+ * Wang Qin
+ * Alex S
+ * Gyepi Sam
+ * Hanna Schroeter
+ * Ralf Schmitt
+ * Mike Smellie
+ * Steve Snyder
+ * Nir Soffer
+ * Dug Song
+ * Dongsheng Song
+ * Hannes Sowa
+ * Joakim Soderberg
+ * Joseph Spadavecchia
+ * Kevin Springborn
+ * Harlan Stenn
+ * Andrew Sweeney
+ * Ferenc Szalai
+ * Brodie Thiesfield
+ * Jason Toffaletti
+ * Brian Utterback
+ * Gisle Vanem
+ * Bas Verhoeven
+ * Constantine Verutin
+ * Colin Watt
+ * Zack Weinberg
+ * Jardel Weyrich
+ * Jay R. Wren
+ * Zack Weinberg
+ * Mobai Zhang
+ * Alejo
+ * Alex
+ * Taral
+ * propanbutan
+ * masksqwe
+ * mmadia
+ * yangacer
+ * Andrey Skriabin
+ * basavesh.as
+ * billsegall
+ * Bill Vaughan
+ * Christopher Wiley
+ * David Paschich
+ * Ed Schouten
+ * Eduardo Panisset
+ * Jan Heylen
+ * jer-gentoo
+ * Joakim Söderberg
+ * kirillDanshin
+ * lzmths
+ * Marcus Sundberg
+ * Mark Mentovai
+ * Mattes D
+ * Matyas Dolak
+ * Neeraj Badlani
+ * Nick Mathewson
+ * Rainer Keller
+ * Seungmo Koo
+ * Thomas Bernard
+ * Xiao Bao Clark
+ * zeliard
+ * Zonr Chang
+ * Kurt Roeckx
+ * Seven
+ * Simone Basso
+ * Vlad Shcherban
+ * Tim Hentenaar
+ * Breaker
+ * johnsonlee
+ * Philip Prindeville
+ * Vis Virial
+ * Andreas Gustafsson
+ * Andrey Okoshkin
+ * an-tao
+ * baixiangcpp
+ * Bernard Spil
+ * Bogdan Harjoc
+ * Carlo Marcelo Arenas Belón
+ * David Benjamin
+ * David Disseldorp
+ * Dmitry Alimov
+ * Dominic Chen
+ * dpayne
+ * ejurgensen
+ * Fredrik Strupe
+ * Gonçalo Ribeiro
+ * James Synge
+ * Jan Beich
+ * Jesse Fang
+ * Jiri Luznicky
+ * José Luis Millán
+ * Kiyoshi Aman
+ * Leo Zhang
+ * lightningkay
+ * Luke Dashjr
+ * Marcin Szewczyk
+ * Maximilian Brunner
+ * Maya Rashish
+ * Murat Demirten
+ * Nathan French
+ * Nikolay Edigaryev
+ * Philip Herron
+ * Redfoxmoon
+ * stenn
+ * SuckShit
+ * The Gitter Badger
+ * tim-le
+ * Vincent JARDIN
+ * Xiang Zhang
+ * Xiaozhou Liu
+ * yongqing.jiao
+ * Enji Cooper
+ * linxiaohui
+ * Seong-Joong Kim
+ * Tobias Stoeckmann
+ * Yury Korzhetsky
+ * zhuizhuhaomeng
+ * Pierce Lopez
+ * yuangongji
+ * Keith Smiley
+ * jeremyerb
+ * Fabrice Fontaine
+ * wenyg
+
+
+If we have forgotten your name, please contact us.
diff --git a/WIN32-Code/nmake/event2/event-config.h b/WIN32-Code/nmake/event2/event-config.h
index 51597c3..35ec16f 100644
--- a/WIN32-Code/nmake/event2/event-config.h
+++ b/WIN32-Code/nmake/event2/event-config.h
@@ -271,7 +271,7 @@
/* #undef EVENT__HAVE_WORKING_KQUEUE */
/* Numeric representation of the version */
-#define EVENT__NUMERIC_VERSION 0x02010a00
+#define EVENT__NUMERIC_VERSION 0x02010b00
/* Name of package */
#define EVENT__PACKAGE "libevent"
@@ -332,7 +332,7 @@
#define EVENT__TIME_WITH_SYS_TIME 1
/* Version number of package */
-#define EVENT__VERSION "2.1.10-stable"
+#define EVENT__VERSION "2.1.11-stable"
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
diff --git a/arc4random.c b/arc4random.c
index 02fd744..be64452 100644
--- a/arc4random.c
+++ b/arc4random.c
@@ -54,6 +54,7 @@
#ifdef _WIN32
#include <wincrypt.h>
#include <process.h>
+#include <winerror.h>
#else
#include <fcntl.h>
#include <unistd.h>
diff --git a/buffer.c b/buffer.c
index 5e3d91b..a51b6c5 100644
--- a/buffer.c
+++ b/buffer.c
@@ -3304,7 +3304,7 @@ evbuffer_add_file(struct evbuffer *buf, int fd, ev_off_t offset, ev_off_t length
return r;
}
-void
+int
evbuffer_setcb(struct evbuffer *buffer, evbuffer_cb cb, void *cbarg)
{
EVBUFFER_LOCK(buffer);
@@ -3315,10 +3315,15 @@ evbuffer_setcb(struct evbuffer *buffer, evbuffer_cb cb, void *cbarg)
if (cb) {
struct evbuffer_cb_entry *ent =
evbuffer_add_cb(buffer, NULL, cbarg);
+ if (!ent) {
+ EVBUFFER_UNLOCK(buffer);
+ return -1;
+ }
ent->cb.cb_obsolete = cb;
ent->flags |= EVBUFFER_CB_OBSOLETE;
}
EVBUFFER_UNLOCK(buffer);
+ return 0;
}
struct evbuffer_cb_entry *
diff --git a/buffer_iocp.c b/buffer_iocp.c
index 2d76a90..2af0c49 100644
--- a/buffer_iocp.c
+++ b/buffer_iocp.c
@@ -44,6 +44,7 @@
#include "mm-internal.h"
#include <winsock2.h>
+#include <winerror.h>
#include <windows.h>
#include <stdio.h>
diff --git a/bufferevent_async.c b/bufferevent_async.c
index 141cf34..40c7c5e 100644
--- a/bufferevent_async.c
+++ b/bufferevent_async.c
@@ -46,6 +46,7 @@
#ifdef _WIN32
#include <winsock2.h>
+#include <winerror.h>
#include <ws2tcpip.h>
#endif
diff --git a/cmake/AddEventLibrary.cmake b/cmake/AddEventLibrary.cmake
index 9de4484..352c86b 100644
--- a/cmake/AddEventLibrary.cmake
+++ b/cmake/AddEventLibrary.cmake
@@ -38,6 +38,10 @@ endmacro()
# Global variables that it uses:
# - EVENT_ABI_LIBVERSION
+# - EVENT_ABI_LIBVERSION_CURRENT
+# - EVENT_ABI_LIBVERSION_REVISION
+# - EVENT_ABI_LIBVERSION_AGE
+# - EVENT_PACKAGE_RELEASE
# - CMAKE_THREAD_LIBS_INIT LIB_PLATFORM
# - OPENSSL_LIBRARIES
# - HDR_PUBLIC
@@ -87,16 +91,44 @@ macro(add_event_library LIB_NAME)
set_event_shared_lib_flags("${LIB_NAME}" "${EVENT_SHARED_FLAGS}")
endif()
- set_target_properties("${LIB_NAME}_shared" PROPERTIES
- OUTPUT_NAME "${LIB_NAME}"
- CLEAN_DIRECT_OUTPUT 1)
- set_target_properties(
- "${LIB_NAME}_shared" PROPERTIES
- PUBLIC_HEADER "${HDR_PUBLIC}")
+ if (WIN32)
+ set_target_properties(
+ "${LIB_NAME}_shared" PROPERTIES
+ OUTPUT_NAME "${LIB_NAME}"
+ SOVERSION ${EVENT_ABI_LIBVERSION})
+ elseif (APPLE)
+ math(EXPR COMPATIBILITY_VERSION "${EVENT_ABI_LIBVERSION_CURRENT}+1")
+ math(EXPR CURRENT_MINUS_AGE "${EVENT_ABI_LIBVERSION_CURRENT}-${EVENT_ABI_LIBVERSION_AGE}")
+ set_target_properties(
+ "${LIB_NAME}_shared" PROPERTIES
+ OUTPUT_NAME "${LIB_NAME}-${EVENT_PACKAGE_RELEASE}.${CURRENT_MINUS_AGE}"
+ INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
+ LINK_FLAGS "-compatibility_version ${COMPATIBILITY_VERSION} -current_version ${COMPATIBILITY_VERSION}.${EVENT_ABI_LIBVERSION_REVISION}")
+ else()
+ math(EXPR CURRENT_MINUS_AGE "${EVENT_ABI_LIBVERSION_CURRENT}-${EVENT_ABI_LIBVERSION_AGE}")
+ set_target_properties(
+ "${LIB_NAME}_shared" PROPERTIES
+ OUTPUT_NAME "${LIB_NAME}-${EVENT_PACKAGE_RELEASE}"
+ VERSION "${CURRENT_MINUS_AGE}.${EVENT_ABI_LIBVERSION_AGE}.${EVENT_ABI_LIBVERSION_REVISION}"
+ SOVERSION "${CURRENT_MINUS_AGE}")
+ endif()
+
set_target_properties(
"${LIB_NAME}_shared" PROPERTIES
- SOVERSION ${EVENT_ABI_LIBVERSION}
- )
+ PUBLIC_HEADER "${HDR_PUBLIC}"
+ CLEAN_DIRECT_OUTPUT 1)
+
+ if (NOT WIN32)
+ set(LIB_LINK_NAME
+ "${CMAKE_SHARED_LIBRARY_PREFIX}${LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}")
+
+ add_custom_command(TARGET ${LIB_NAME}_shared
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E create_symlink
+ "$<TARGET_FILE_NAME:${LIB_NAME}_shared>"
+ "${LIB_LINK_NAME}"
+ WORKING_DIRECTORY "lib")
+ endif()
list(APPEND LIBEVENT_SHARED_LIBRARIES "${LIB_NAME}_shared")
list(APPEND ADD_EVENT_LIBRARY_TARGETS "${LIB_NAME}_shared")
@@ -117,6 +149,12 @@ macro(add_event_library LIB_NAME)
PUBLIC_HEADER DESTINATION "include/event2"
COMPONENT dev
)
+ if (NOT WIN32 AND ${EVENT_LIBRARY_SHARED})
+ install(FILES
+ "$<TARGET_FILE_DIR:${LIB_NAME}_shared>/${LIB_LINK_NAME}"
+ DESTINATION "lib"
+ COMPONENT lib)
+ endif()
add_library(${LIB_NAME} INTERFACE)
target_link_libraries(${LIB_NAME} INTERFACE ${ADD_EVENT_LIBRARY_INTERFACE})
diff --git a/cmake/VersionViaGit.cmake b/cmake/VersionViaGit.cmake
index 9ac7e30..504980a 100644
--- a/cmake/VersionViaGit.cmake
+++ b/cmake/VersionViaGit.cmake
@@ -23,8 +23,8 @@ macro(event_fuzzy_version_from_git)
# set our defaults.
set(EVENT_GIT___VERSION_MAJOR 2)
set(EVENT_GIT___VERSION_MINOR 1)
- set(EVENT_GIT___VERSION_PATCH 10)
- set(EVENT_GIT___VERSION_STAGE "beta")
+ set(EVENT_GIT___VERSION_PATCH 11)
+ set(EVENT_GIT___VERSION_STAGE "stable")
find_package(Git)
diff --git a/configure b/configure
index cc3cc68..d5e286a 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libevent 2.1.10-stable.
+# Generated by GNU Autoconf 2.69 for libevent 2.1.11-stable.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libevent'
PACKAGE_TARNAME='libevent'
-PACKAGE_VERSION='2.1.10-stable'
-PACKAGE_STRING='libevent 2.1.10-stable'
+PACKAGE_VERSION='2.1.11-stable'
+PACKAGE_STRING='libevent 2.1.11-stable'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1374,7 +1374,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures libevent 2.1.10-stable to adapt to many kinds of systems.
+\`configure' configures libevent 2.1.11-stable to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1444,7 +1444,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libevent 2.1.10-stable:";;
+ short | recursive ) echo "Configuration of libevent 2.1.11-stable:";;
esac
cat <<\_ACEOF
@@ -1575,7 +1575,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libevent configure 2.1.10-stable
+libevent configure 2.1.11-stable
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2280,7 +2280,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libevent $as_me 2.1.10-stable, which was
+It was created by libevent $as_me 2.1.11-stable, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3147,7 +3147,7 @@ fi
# Define the identity of the package.
PACKAGE='libevent'
- VERSION='2.1.10-stable'
+ VERSION='2.1.11-stable'
cat >>confdefs.h <<_ACEOF
@@ -3282,7 +3282,7 @@ AM_BACKSLASH='\'
ac_config_headers="$ac_config_headers config.h evconfig-private.h:evconfig-private.h.in"
-$as_echo "#define NUMERIC_VERSION 0x02010a00" >>confdefs.h
+$as_echo "#define NUMERIC_VERSION 0x02010b00" >>confdefs.h
if test "$prefix" = "NONE"; then
@@ -13655,7 +13655,7 @@ fi
;;
esac
CPPFLAGS_SAVE=$CPPFLAGS
- CPPFLAGS+=$OPENSSL_INCS
+ CPPFLAGS="$CPPFLAGS $OPENSSL_INCS"
for ac_header in openssl/ssl.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default"
@@ -16944,7 +16944,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libevent $as_me 2.1.10-stable, which was
+This file was extended by libevent $as_me 2.1.11-stable, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -17010,7 +17010,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-libevent config.status 2.1.10-stable
+libevent config.status 2.1.11-stable
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index e644034..298d3ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,8 +5,8 @@ dnl See LICENSE for copying information.
dnl
dnl Original version Dug Song <dugsong@monkey.org>
-AC_INIT(libevent,2.1.10-stable)
-AC_PREREQ(2.59)
+AC_INIT(libevent,2.1.11-stable)
+AC_PREREQ(2.62)
AC_CONFIG_SRCDIR(event.c)
AC_CONFIG_MACRO_DIR([m4])
@@ -14,7 +14,7 @@ AM_INIT_AUTOMAKE
dnl AM_SILENT_RULES req. automake 1.11. [no] defaults V=1
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_CONFIG_HEADERS(config.h evconfig-private.h:evconfig-private.h.in)
-AC_DEFINE(NUMERIC_VERSION, 0x02010a00, [Numeric representation of the version])
+AC_DEFINE(NUMERIC_VERSION, 0x02010b00, [Numeric representation of the version])
dnl Initialize prefix.
if test "$prefix" = "NONE"; then
diff --git a/evdns.c b/evdns.c
index 1b81536..de3848a 100644
--- a/evdns.c
+++ b/evdns.c
@@ -77,6 +77,7 @@
#include <stdarg.h>
#ifdef _WIN32
#include <winsock2.h>
+#include <winerror.h>
#include <ws2tcpip.h>
#ifndef _WIN32_IE
#define _WIN32_IE 0x400
@@ -346,6 +347,9 @@ struct evdns_base {
struct timeval global_getaddrinfo_allow_skew;
+ int so_rcvbuf;
+ int so_sndbuf;
+
int getaddrinfo_ipv4_timeouts;
int getaddrinfo_ipv6_timeouts;
int getaddrinfo_ipv4_answered;
@@ -2538,6 +2542,23 @@ evdns_nameserver_add_impl_(struct evdns_base *base, const struct sockaddr *addre
}
}
+ if (base->so_rcvbuf) {
+ if (setsockopt(ns->socket, SOL_SOCKET, SO_RCVBUF,
+ (void *)&base->so_rcvbuf, sizeof(base->so_rcvbuf))) {
+ log(EVDNS_LOG_WARN, "Couldn't set SO_RCVBUF to %i", base->so_rcvbuf);
+ err = -SO_RCVBUF;
+ goto out2;
+ }
+ }
+ if (base->so_sndbuf) {
+ if (setsockopt(ns->socket, SOL_SOCKET, SO_SNDBUF,
+ (void *)&base->so_sndbuf, sizeof(base->so_sndbuf))) {
+ log(EVDNS_LOG_WARN, "Couldn't set SO_SNDBUF to %i", base->so_sndbuf);
+ err = -SO_SNDBUF;
+ goto out2;
+ }
+ }
+
memcpy(&ns->address, address, addrlen);
ns->addrlen = addrlen;
ns->state = 1;
@@ -3531,6 +3552,16 @@ evdns_base_set_option_impl(struct evdns_base *base,
val);
memcpy(&base->global_nameserver_probe_initial_timeout, &tv,
sizeof(tv));
+ } else if (str_matches_option(option, "so-rcvbuf:")) {
+ int buf = strtoint(val);
+ if (!(flags & DNS_OPTION_MISC)) return 0;
+ log(EVDNS_LOG_DEBUG, "Setting SO_RCVBUF to %s", val);
+ base->so_rcvbuf = buf;
+ } else if (str_matches_option(option, "so-sndbuf:")) {
+ int buf = strtoint(val);
+ if (!(flags & DNS_OPTION_MISC)) return 0;
+ log(EVDNS_LOG_DEBUG, "Setting SO_SNDBUF to %s", val);
+ base->so_sndbuf = buf;
}
return 0;
}
diff --git a/event.c b/event.c
index a778f96..b2ad341 100644
--- a/event.c
+++ b/event.c
@@ -837,8 +837,7 @@ static int event_base_free_queues_(struct event_base *base, int run_finalizers)
static void
event_base_free_(struct event_base *base, int run_finalizers)
{
- int i;
- size_t n_deleted=0;
+ int i, n_deleted=0;
struct event *ev;
/* XXXX grab the lock? If there is contention when one thread frees
* the base, then the contending thread will be very sad soon. */
@@ -913,7 +912,7 @@ event_base_free_(struct event_base *base, int run_finalizers)
}
if (n_deleted)
- event_debug(("%s: "EV_SIZE_FMT" events were still set in base",
+ event_debug(("%s: %d events were still set in base",
__func__, n_deleted));
while (LIST_FIRST(&base->once_events)) {
@@ -988,6 +987,12 @@ event_reinit(struct event_base *base)
EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+ if (base->running_loop) {
+ event_warnx("%s: forked from the event_loop.", __func__);
+ res = -1;
+ goto done;
+ }
+
evsel = base->evsel;
/* check if this event mechanism requires reinit on the backend */
@@ -3679,7 +3684,7 @@ event_base_foreach_event_nolock_(struct event_base *base,
event_base_foreach_event_cb fn, void *arg)
{
int r, i;
- size_t u;
+ unsigned u;
struct event *ev;
/* Start out with all the EVLIST_INSERTED events. */
@@ -3832,7 +3837,7 @@ event_base_active_by_fd(struct event_base *base, evutil_socket_t fd, short event
/* If we want to activate timer events, loop and activate each event with
* the same fd in both the timeheap and common timeouts list */
int i;
- size_t u;
+ unsigned u;
struct event *ev;
for (u = 0; u < base->timeheap.n; ++u) {
@@ -3962,21 +3967,20 @@ void
event_base_assert_ok_nolock_(struct event_base *base)
{
int i;
- size_t u;
int count;
/* First do checks on the per-fd and per-signal lists */
evmap_check_integrity_(base);
/* Check the heap property */
- for (u = 1; u < base->timeheap.n; ++u) {
- size_t parent = (u - 1) / 2;
+ for (i = 1; i < (int)base->timeheap.n; ++i) {
+ int parent = (i - 1) / 2;
struct event *ev, *p_ev;
- ev = base->timeheap.p[u];
+ ev = base->timeheap.p[i];
p_ev = base->timeheap.p[parent];
EVUTIL_ASSERT(ev->ev_flags & EVLIST_TIMEOUT);
EVUTIL_ASSERT(evutil_timercmp(&p_ev->ev_timeout, &ev->ev_timeout, <=));
- EVUTIL_ASSERT(ev->ev_timeout_pos.min_heap_idx == u);
+ EVUTIL_ASSERT(ev->ev_timeout_pos.min_heap_idx == i);
}
/* Check that the common timeouts are fine */
diff --git a/evutil.c b/evutil.c
index 402ab0d..3412c2a 100644
--- a/evutil.c
+++ b/evutil.c
@@ -29,6 +29,7 @@
#ifdef _WIN32
#include <winsock2.h>
+#include <winerror.h>
#include <ws2tcpip.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -750,7 +751,7 @@ done:
/* Test whether we have an ipv4 interface and an ipv6 interface. Return 0 if
* the test seemed successful. */
static int
-evutil_check_interfaces(int force_recheck)
+evutil_check_interfaces(void)
{
evutil_socket_t fd = -1;
struct sockaddr_in sin, sin_out;
@@ -758,9 +759,12 @@ evutil_check_interfaces(int force_recheck)
ev_socklen_t sin_out_len = sizeof(sin_out);
ev_socklen_t sin6_out_len = sizeof(sin6_out);
int r;
- if (have_checked_interfaces && !force_recheck)
+ if (have_checked_interfaces)
return 0;
+ /* From this point on we have done the ipv4/ipv6 interface check */
+ have_checked_interfaces = 1;
+
if (evutil_check_ifaddrs() == 0) {
/* Use a nice sane interface, if this system has one. */
return 0;
@@ -1228,8 +1232,7 @@ evutil_adjust_hints_for_addrconfig_(struct evutil_addrinfo *hints)
return;
if (hints->ai_family != PF_UNSPEC)
return;
- if (!have_checked_interfaces)
- evutil_check_interfaces(0);
+ evutil_check_interfaces();
if (had_ipv4_address && !had_ipv6_address) {
hints->ai_family = PF_INET;
} else if (!had_ipv4_address && had_ipv6_address) {
diff --git a/include/event2/buffer_compat.h b/include/event2/buffer_compat.h
index 24f828c..0ce1025 100644
--- a/include/event2/buffer_compat.h
+++ b/include/event2/buffer_compat.h
@@ -90,9 +90,10 @@ typedef void (*evbuffer_cb)(struct evbuffer *buffer, size_t old_len, size_t new_
@param cb the callback function to invoke when the evbuffer is modified,
or NULL to remove all callbacks.
@param cbarg an argument to be provided to the callback function
+ @return 0 if successful, or -1 on error
*/
EVENT2_EXPORT_SYMBOL
-void evbuffer_setcb(struct evbuffer *buffer, evbuffer_cb cb, void *cbarg);
+int evbuffer_setcb(struct evbuffer *buffer, evbuffer_cb cb, void *cbarg);
/**
diff --git a/include/event2/bufferevent.h b/include/event2/bufferevent.h
index dac34dc..48cd153 100644
--- a/include/event2/bufferevent.h
+++ b/include/event2/bufferevent.h
@@ -491,7 +491,7 @@ short bufferevent_get_enabled(struct bufferevent *bufev);
(In other words, if reading or writing is disabled, or if the
bufferevent's read or write operation has been suspended because
- there's no data to write, or not enough banwidth, or so on, the
+ there's no data to write, or not enough bandwidth, or so on, the
timeout isn't active. The timeout only becomes active when we we're
willing to actually read or write.)
@@ -569,7 +569,7 @@ void bufferevent_unlock(struct bufferevent *bufev);
/**
* Public interface to manually increase the reference count of a bufferevent
* this is useful in situations where a user may reference the bufferevent
- * somewhere eles (unknown to libevent)
+ * somewhere else (unknown to libevent)
*
* @param bufev the bufferevent to increase the refcount on
*
@@ -802,7 +802,7 @@ void ev_token_bucket_cfg_free(struct ev_token_bucket_cfg *cfg);
They are: socket-based bufferevents (normal and IOCP-based), and SSL-based
bufferevents.
- Return 0 on sucess, -1 on failure.
+ Return 0 on success, -1 on failure.
*/
EVENT2_EXPORT_SYMBOL
int bufferevent_set_rate_limit(struct bufferevent *bev,
@@ -853,7 +853,7 @@ int bufferevent_rate_limit_group_set_cfg(
The default min-share is currently 64 bytes.
- Returns 0 on success, -1 on faulre.
+ Returns 0 on success, -1 on failure.
*/
EVENT2_EXPORT_SYMBOL
int bufferevent_rate_limit_group_set_min_share(
diff --git a/include/event2/dns.h b/include/event2/dns.h
index 3c548a1..13ce027 100644
--- a/include/event2/dns.h
+++ b/include/event2/dns.h
@@ -455,7 +455,8 @@ void evdns_cancel_request(struct evdns_base *base, struct evdns_request *req);
The currently available configuration options are:
ndots, timeout, max-timeouts, max-inflight, attempts, randomize-case,
- bind-to, initial-probe-timeout, getaddrinfo-allow-skew.
+ bind-to, initial-probe-timeout, getaddrinfo-allow-skew,
+ so-rcvbuf, so-sndbuf.
In versions before Libevent 2.0.3-alpha, the option name needed to end with
a colon.
diff --git a/include/event2/event.h b/include/event2/event.h
index ff20851..a6b6144 100644
--- a/include/event2/event.h
+++ b/include/event2/event.h
@@ -285,7 +285,7 @@ struct event
* There are many options that can be used to alter the behavior and
* implementation of an event_base. To avoid having to pass them all in a
* complex many-argument constructor, we provide an abstract data type
- * where you set up configation information before passing it to
+ * where you set up configuration information before passing it to
* event_base_new_with_config().
*
* @see event_config_new(), event_config_free(), event_base_new_with_config(),
@@ -632,7 +632,7 @@ int event_config_set_num_cpus_hint(struct event_config *cfg, int cpus);
/**
* Record an interval and/or a number of callbacks after which the event base
* should check for new events. By default, the event base will run as many
- * events are as activated at the higest activated priority before checking
+ * events are as activated at the highest activated priority before checking
* for new events. If you configure it by setting max_interval, it will check
* the time after each callback, and not allow more than max_interval to
* elapse before checking for new events. If you configure it by setting
@@ -1321,7 +1321,7 @@ struct event *event_base_get_running_event(struct event_base *base);
The event_initialized() function can be used to check if an event has been
initialized.
- Warning: This function is only useful for distinguishing a a zeroed-out
+ Warning: This function is only useful for distinguishing a zeroed-out
piece of memory from an initialized event, it can easily be confused by
uninitialized memory. Thus, it should ONLY be used to distinguish an
initialized event from zero.
diff --git a/include/event2/event_struct.h b/include/event2/event_struct.h
index 35c5170..1c8b71b 100644
--- a/include/event2/event_struct.h
+++ b/include/event2/event_struct.h
@@ -126,7 +126,7 @@ struct event {
/* for managing timeouts */
union {
TAILQ_ENTRY(event) ev_next_with_common_timeout;
- size_t min_heap_idx;
+ int min_heap_idx;
} ev_timeout_pos;
evutil_socket_t ev_fd;
diff --git a/include/include.am b/include/include.am
index 9aad2db..aaa2042 100644
--- a/include/include.am
+++ b/include/include.am
@@ -1,4 +1,4 @@
-# include/Makefile.am for libevent
+# include/include.am for libevent
# Copyright 2000-2007 Niels Provos
# Copyright 2007-2012 Niels Provos and Nick Mathewson
#
@@ -11,7 +11,6 @@ EVENT2_EXPORT = \
include/event2/buffer_compat.h \
include/event2/bufferevent.h \
include/event2/bufferevent_compat.h \
- include/event2/bufferevent_ssl.h \
include/event2/bufferevent_struct.h \
include/event2/dns.h \
include/event2/dns_compat.h \
@@ -33,6 +32,10 @@ EVENT2_EXPORT = \
include/event2/util.h \
include/event2/visibility.h
+if OPENSSL
+EVENT2_EXPORT += include/event2/bufferevent_ssl.h
+endif
+
## Without the nobase_ prefixing, Automake would strip "include/event2/" from
## the source header filename to derive the installed header filename.
## With nobase_ the installed path is $(includedir)/include/event2/ev*.h.
diff --git a/listener.c b/listener.c
index 387a89e..f5c00c9 100644
--- a/listener.c
+++ b/listener.c
@@ -35,6 +35,7 @@
#define _WIN32_WINNT 0x0403
#endif
#include <winsock2.h>
+#include <winerror.h>
#include <ws2tcpip.h>
#include <mswsock.h>
#endif
diff --git a/m4/libevent_openssl.m4 b/m4/libevent_openssl.m4
index 7b45813..1981198 100644
--- a/m4/libevent_openssl.m4
+++ b/m4/libevent_openssl.m4
@@ -40,7 +40,7 @@ case "$enable_openssl" in
;;
esac
CPPFLAGS_SAVE=$CPPFLAGS
- CPPFLAGS+=$OPENSSL_INCS
+ CPPFLAGS="$CPPFLAGS $OPENSSL_INCS"
AC_CHECK_HEADERS([openssl/ssl.h], [], [have_openssl=no])
CPPFLAGS=$CPPFLAGS_SAVE
AC_SUBST(OPENSSL_INCS)
diff --git a/minheap-internal.h b/minheap-internal.h
index 858e7eb..b3a0eb1 100644
--- a/minheap-internal.h
+++ b/minheap-internal.h
@@ -39,7 +39,7 @@
typedef struct min_heap
{
struct event** p;
- size_t n, a;
+ unsigned n, a;
} min_heap_t;
static inline void min_heap_ctor_(min_heap_t* s);
@@ -47,30 +47,30 @@ static inline void min_heap_dtor_(min_heap_t* s);
static inline void min_heap_elem_init_(struct event* e);
static inline int min_heap_elt_is_top_(const struct event *e);
static inline int min_heap_empty_(min_heap_t* s);
-static inline size_t min_heap_size_(min_heap_t* s);
+static inline unsigned min_heap_size_(min_heap_t* s);
static inline struct event* min_heap_top_(min_heap_t* s);
-static inline int min_heap_reserve_(min_heap_t* s, size_t n);
+static inline int min_heap_reserve_(min_heap_t* s, unsigned n);
static inline int min_heap_push_(min_heap_t* s, struct event* e);
static inline struct event* min_heap_pop_(min_heap_t* s);
static inline int min_heap_adjust_(min_heap_t *s, struct event* e);
static inline int min_heap_erase_(min_heap_t* s, struct event* e);
-static inline void min_heap_shift_up_(min_heap_t* s, size_t hole_index, struct event* e);
-static inline void min_heap_shift_up_unconditional_(min_heap_t* s, size_t hole_index, struct event* e);
-static inline void min_heap_shift_down_(min_heap_t* s, size_t hole_index, struct event* e);
+static inline void min_heap_shift_up_(min_heap_t* s, unsigned hole_index, struct event* e);
+static inline void min_heap_shift_up_unconditional_(min_heap_t* s, unsigned hole_index, struct event* e);
+static inline void min_heap_shift_down_(min_heap_t* s, unsigned hole_index, struct event* e);
#define min_heap_elem_greater(a, b) \
(evutil_timercmp(&(a)->ev_timeout, &(b)->ev_timeout, >))
void min_heap_ctor_(min_heap_t* s) { s->p = 0; s->n = 0; s->a = 0; }
void min_heap_dtor_(min_heap_t* s) { if (s->p) mm_free(s->p); }
-void min_heap_elem_init_(struct event* e) { e->ev_timeout_pos.min_heap_idx = EV_SIZE_MAX; }
-int min_heap_empty_(min_heap_t* s) { return 0 == s->n; }
-size_t min_heap_size_(min_heap_t* s) { return s->n; }
+void min_heap_elem_init_(struct event* e) { e->ev_timeout_pos.min_heap_idx = -1; }
+int min_heap_empty_(min_heap_t* s) { return 0u == s->n; }
+unsigned min_heap_size_(min_heap_t* s) { return s->n; }
struct event* min_heap_top_(min_heap_t* s) { return s->n ? *s->p : 0; }
int min_heap_push_(min_heap_t* s, struct event* e)
{
- if (min_heap_reserve_(s, s->n + 1))
+ if (s->n == UINT32_MAX || min_heap_reserve_(s, s->n + 1))
return -1;
min_heap_shift_up_(s, s->n++, e);
return 0;
@@ -81,8 +81,8 @@ struct event* min_heap_pop_(min_heap_t* s)
if (s->n)
{
struct event* e = *s->p;
- min_heap_shift_down_(s, 0, s->p[--s->n]);
- e->ev_timeout_pos.min_heap_idx = EV_SIZE_MAX;
+ min_heap_shift_down_(s, 0u, s->p[--s->n]);
+ e->ev_timeout_pos.min_heap_idx = -1;
return e;
}
return 0;
@@ -95,10 +95,10 @@ int min_heap_elt_is_top_(const struct event *e)
int min_heap_erase_(min_heap_t* s, struct event* e)
{
- if (EV_SIZE_MAX != e->ev_timeout_pos.min_heap_idx)
+ if (-1 != e->ev_timeout_pos.min_heap_idx)
{
struct event *last = s->p[--s->n];
- size_t parent = (e->ev_timeout_pos.min_heap_idx - 1) / 2;
+ unsigned parent = (e->ev_timeout_pos.min_heap_idx - 1) / 2;
/* we replace e with the last element in the heap. We might need to
shift it upward if it is less than its parent, or downward if it is
greater than one or both its children. Since the children are known
@@ -108,7 +108,7 @@ int min_heap_erase_(min_heap_t* s, struct event* e)
min_heap_shift_up_unconditional_(s, e->ev_timeout_pos.min_heap_idx, last);
else
min_heap_shift_down_(s, e->ev_timeout_pos.min_heap_idx, last);
- e->ev_timeout_pos.min_heap_idx = EV_SIZE_MAX;
+ e->ev_timeout_pos.min_heap_idx = -1;
return 0;
}
return -1;
@@ -116,10 +116,10 @@ int min_heap_erase_(min_heap_t* s, struct event* e)
int min_heap_adjust_(min_heap_t *s, struct event *e)
{
- if (EV_SIZE_MAX == e->ev_timeout_pos.min_heap_idx) {
+ if (-1 == e->ev_timeout_pos.min_heap_idx) {
return min_heap_push_(s, e);
} else {
- size_t parent = (e->ev_timeout_pos.min_heap_idx - 1) / 2;
+ unsigned parent = (e->ev_timeout_pos.min_heap_idx - 1) / 2;
/* The position of e has changed; we shift it up or down
* as needed. We can't need to do both. */
if (e->ev_timeout_pos.min_heap_idx > 0 && min_heap_elem_greater(s->p[parent], e))
@@ -130,14 +130,18 @@ int min_heap_adjust_(min_heap_t *s, struct event *e)
}
}
-int min_heap_reserve_(min_heap_t* s, size_t n)
+int min_heap_reserve_(min_heap_t* s, unsigned n)
{
if (s->a < n)
{
struct event** p;
- size_t a = s->a ? s->a * 2 : 8;
+ unsigned a = s->a ? s->a * 2 : 8;
if (a < n)
a = n;
+#if (SIZE_MAX == UINT32_MAX)
+ if (a > SIZE_MAX / sizeof *p)
+ return -1;
+#endif
if (!(p = (struct event**)mm_realloc(s->p, a * sizeof *p)))
return -1;
s->p = p;
@@ -146,9 +150,9 @@ int min_heap_reserve_(min_heap_t* s, size_t n)
return 0;
}
-void min_heap_shift_up_unconditional_(min_heap_t* s, size_t hole_index, struct event* e)
+void min_heap_shift_up_unconditional_(min_heap_t* s, unsigned hole_index, struct event* e)
{
- size_t parent = (hole_index - 1) / 2;
+ unsigned parent = (hole_index - 1) / 2;
do
{
(s->p[hole_index] = s->p[parent])->ev_timeout_pos.min_heap_idx = hole_index;
@@ -158,9 +162,9 @@ void min_heap_shift_up_unconditional_(min_heap_t* s, size_t hole_index, struct e
(s->p[hole_index] = e)->ev_timeout_pos.min_heap_idx = hole_index;
}
-void min_heap_shift_up_(min_heap_t* s, size_t hole_index, struct event* e)
+void min_heap_shift_up_(min_heap_t* s, unsigned hole_index, struct event* e)
{
- size_t parent = (hole_index - 1) / 2;
+ unsigned parent = (hole_index - 1) / 2;
while (hole_index && min_heap_elem_greater(s->p[parent], e))
{
(s->p[hole_index] = s->p[parent])->ev_timeout_pos.min_heap_idx = hole_index;
@@ -170,9 +174,9 @@ void min_heap_shift_up_(min_heap_t* s, size_t hole_index, struct event* e)
(s->p[hole_index] = e)->ev_timeout_pos.min_heap_idx = hole_index;
}
-void min_heap_shift_down_(min_heap_t* s, size_t hole_index, struct event* e)
+void min_heap_shift_down_(min_heap_t* s, unsigned hole_index, struct event* e)
{
- size_t min_child = 2 * (hole_index + 1);
+ unsigned min_child = 2 * (hole_index + 1);
while (min_child <= s->n)
{
min_child -= min_child == s->n || min_heap_elem_greater(s->p[min_child], s->p[min_child - 1]);
diff --git a/sample/https-client.c b/sample/https-client.c
index 5869974..58e449b 100644
--- a/sample/https-client.c
+++ b/sample/https-client.c
@@ -53,7 +53,7 @@ http_request_done(struct evhttp_request *req, void *ctx)
char buffer[256];
int nread;
- if (req == NULL) {
+ if (!req || !evhttp_request_get_response_code(req)) {
/* If req is NULL, it means an error occurred, but
* sadly we are mostly left guessing what the error
* might have been. We'll do our best... */
diff --git a/test/regress_buffer.c b/test/regress_buffer.c
index 02d557b..8ac4b6e 100644
--- a/test/regress_buffer.c
+++ b/test/regress_buffer.c
@@ -1956,12 +1956,12 @@ test_evbuffer_callbacks(void *ptr)
tt_assert(cb1 != NULL);
cb2 = evbuffer_add_cb(buf, log_change_callback, buf_out2);
tt_assert(cb2 != NULL);
- evbuffer_setcb(buf, self_draining_callback, NULL);
+ tt_int_op(evbuffer_setcb(buf, self_draining_callback, NULL), ==, 0);
evbuffer_add_printf(buf, "This should get drained right away.");
tt_uint_op(evbuffer_get_length(buf), ==, 0);
tt_uint_op(evbuffer_get_length(buf_out1), ==, 0);
tt_uint_op(evbuffer_get_length(buf_out2), ==, 0);
- evbuffer_setcb(buf, NULL, NULL);
+ tt_int_op(evbuffer_setcb(buf, NULL, NULL), ==, 0);
evbuffer_add_printf(buf, "This will not.");
tt_str_op((const char *) evbuffer_pullup(buf, -1), ==, "This will not.");
evbuffer_validate(buf);
@@ -1987,6 +1987,14 @@ test_evbuffer_callbacks(void *ptr)
"0->15; 15->11; 11->0; ");
#endif
+ /* the next call to readline should fail */
+#ifndef EVENT__DISABLE_MM_REPLACEMENT
+ event_set_mem_functions(failing_malloc, realloc, free);
+ tt_int_op(evbuffer_setcb(buf, self_draining_callback, NULL), ==, -1);
+ evbuffer_validate(buf);
+ event_set_mem_functions(malloc, realloc, free);
+#endif
+
end:
if (buf)
evbuffer_free(buf);
diff --git a/test/regress_dns.c b/test/regress_dns.c
index 76b0b86..d2084b7 100644
--- a/test/regress_dns.c
+++ b/test/regress_dns.c
@@ -2352,6 +2352,26 @@ end:
}
#endif
+static void
+test_set_so_rcvbuf_so_sndbuf(void *arg)
+{
+ struct basic_test_data *data = arg;
+ struct evdns_base *dns_base;
+
+ dns_base = evdns_base_new(data->base, 0);
+ tt_assert(dns_base);
+
+ tt_assert(!evdns_base_set_option(dns_base, "so-rcvbuf", "10240"));
+ tt_assert(!evdns_base_set_option(dns_base, "so-sndbuf", "10240"));
+
+ /* actually check SO_RCVBUF/SO_SNDBUF not fails */
+ tt_assert(!evdns_base_nameserver_ip_add(dns_base, "127.0.0.1"));
+
+end:
+ if (dns_base)
+ evdns_base_free(dns_base, 0);
+}
+
#define DNS_LEGACY(name, flags) \
{ #name, run_legacy_test_fn, flags|TT_LEGACY, &legacy_setup, \
dns_##name }
@@ -2421,6 +2441,9 @@ struct testcase_t dns_testcases[] = {
TT_FORK|TT_OFF_BY_DEFAULT, NULL, NULL },
#endif
+ { "set_SO_RCVBUF_SO_SNDBUF", test_set_so_rcvbuf_so_sndbuf,
+ TT_FORK|TT_NEED_BASE, &basic_setup, NULL },
+
END_OF_TESTCASES
};
diff --git a/util-internal.h b/util-internal.h
index b727bf1..39576c7 100644
--- a/util-internal.h
+++ b/util-internal.h
@@ -52,16 +52,22 @@ extern "C" {
/* __has_attribute() wrapper */
#ifdef __has_attribute
-#define EVUTIL_HAS_ATTRIBUTE __has_attribute
+# define EVUTIL_HAS_ATTRIBUTE __has_attribute
#endif
/** clang 3 __has_attribute misbehaves in some versions */
-#if defined(__clang__) && \
- __clang__ == 1 && __clang_major__ == 3 && \
- (__clang_minor__ >= 2 && __clang_minor__ <= 5)
-#undef EVUTIL_HAS_ATTRIBUTE
-#endif
+#if defined(__clang__) && __clang__ == 1
+# if defined(__apple_build_version__)
+# if __clang_major__ <= 6
+# undef EVUTIL_HAS_ATTRIBUTE
+# endif
+# else /* !__apple_build_version__ */
+# if __clang_major__ == 3 && __clang_minor__ >= 2 && __clang_minor__ <= 5
+# undef EVUTIL_HAS_ATTRIBUTE
+# endif
+# endif /* __apple_build_version__ */
+#endif /*\ defined(__clang__) && __clang__ == 1 */
#ifndef EVUTIL_HAS_ATTRIBUTE
-#define EVUTIL_HAS_ATTRIBUTE(x) 0
+# define EVUTIL_HAS_ATTRIBUTE(x) 0
#endif
/* If we need magic to say "inline", get it for free internally. */