mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Merge branch 'release-2.1.11-stable-pull' into patches-2.1
* release-2.1.11-stable-pull: Bump version to 2.1.11-stable (with ABI breakage) Bump ChangeLog Bump AUTHORS.md ...
This commit is contained in:
commit
4c908dde58
2
.gitignore
vendored
2
.gitignore
vendored
@ -129,6 +129,7 @@ LibeventConfigVersion.cmake
|
||||
LibeventTargets.cmake
|
||||
bin/
|
||||
cmake_install.cmake
|
||||
Uninstall.cmake
|
||||
lib/
|
||||
tmp/
|
||||
verify_tests.sh
|
||||
@ -139,6 +140,7 @@ event_extra.dir
|
||||
*.vcxproj
|
||||
*.sln
|
||||
*.filters
|
||||
install_manifest.txt
|
||||
|
||||
# ninja
|
||||
build.ninja
|
||||
|
@ -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 "")
|
||||
|
46
ChangeLog
46
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
|
||||
|
10
Makefile.am
10
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)
|
||||
|
||||
|
@ -459,5 +459,11 @@ fixing bugs:
|
||||
* Yury Korzhetsky
|
||||
* zhuizhuhaomeng
|
||||
* Pierce Lopez
|
||||
* yuangongji
|
||||
* Keith Smiley
|
||||
* jeremyerb
|
||||
* Fabrice Fontaine
|
||||
* wenyg
|
||||
|
||||
|
||||
If we have forgotten your name, please contact us.
|
||||
|
@ -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. */
|
||||
|
@ -1,4 +1,4 @@
|
||||
version: 2.1.10.{build}
|
||||
version: 2.1.11.{build}
|
||||
|
||||
os: Visual Studio 2017
|
||||
platform:
|
||||
|
@ -54,6 +54,7 @@
|
||||
#ifdef _WIN32
|
||||
#include <wincrypt.h>
|
||||
#include <process.h>
|
||||
#include <winerror.h>
|
||||
#else
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
7
buffer.c
7
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 *
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "mm-internal.h"
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <winerror.h>
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -46,6 +46,7 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#include <winerror.h>
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
|
@ -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}"
|
||||
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
|
||||
PUBLIC_HEADER "${HDR_PUBLIC}"
|
||||
CLEAN_DIRECT_OUTPUT 1)
|
||||
set_target_properties(
|
||||
"${LIB_NAME}_shared" PROPERTIES
|
||||
PUBLIC_HEADER "${HDR_PUBLIC}")
|
||||
set_target_properties(
|
||||
"${LIB_NAME}_shared" PROPERTIES
|
||||
SOVERSION ${EVENT_ABI_LIBVERSION}
|
||||
)
|
||||
|
||||
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})
|
||||
|
23
cmake/Uninstall.cmake.in
Normal file
23
cmake/Uninstall.cmake.in
Normal file
@ -0,0 +1,23 @@
|
||||
# https://gitlab.kitware.com/cmake/community/wikis/FAQ#can-i-do-make-uninstall-with-cmake
|
||||
|
||||
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
|
||||
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
|
||||
endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
|
||||
|
||||
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
|
||||
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||
foreach(file ${files})
|
||||
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
|
||||
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
||||
exec_program(
|
||||
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RETURN_VALUE rm_retval
|
||||
)
|
||||
if(NOT "${rm_retval}" STREQUAL 0)
|
||||
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
|
||||
endif(NOT "${rm_retval}" STREQUAL 0)
|
||||
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
||||
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
|
||||
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
||||
endforeach(file)
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
31
evdns.c
31
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;
|
||||
}
|
||||
|
6
event.c
6
event.c
@ -987,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 */
|
||||
|
11
evutil.c
11
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) {
|
||||
|
@ -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);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -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(
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -35,6 +35,7 @@
|
||||
#define _WIN32_WINNT 0x0403
|
||||
#endif
|
||||
#include <winsock2.h>
|
||||
#include <winerror.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <mswsock.h>
|
||||
#endif
|
||||
|
@ -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)
|
||||
|
@ -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... */
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
};
|
||||
|
||||
|
@ -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. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user