A public libevent repository. The official repository is at https://github.com/libevent/libevent
C CMake Python C++ Roff M4 Other
Pull request Compare This branch is even with nmathewson:master.
Latest commit c6c74ce Apr 21, 2017 @davidben davidben Explicitly call SSL_clear when reseting the fd.
If reconnecting the via BEV_CTRL_SET_FD, bufferevent_openssl.c expects
OpenSSL to reuse the configuration state in the SSL object but retain
connection state. This corresponds to the SSL_clear API.

The code currently only calls SSL_set_connect_state or
SSL_set_accept_state. Due to a quirk in OpenSSL, doing this causes the
handshake to implicitly SSL_clear the next time it is entered. However,
this, in the intervening time, leaves the SSL object in an odd state as
the connection state has not been dropped yet. This behavior also does
not appear to be documented by OpenSSL.

Instead, call SSL_clear explicitly:
https://www.openssl.org/docs/manmaster/man3/SSL_clear.html
Permalink
Failed to load latest commit information.
WIN32-Code cmake: clean not used #defines from event-config.h Mar 13, 2017
cmake cmake: use APPEND during exporting targets (for old cmake) Mar 14, 2017
compat/sys Fix all identifiers with names beginning with underscore. Feb 29, 2012
include Fix arc4random_addrandom() detecting and fallback (regression) Mar 27, 2017
m4 autotools/win32: fix searching ssl library Aug 9, 2016
sample sample/https-client: use ERR_remove_*state() when we have them Mar 5, 2017
test test: do not return void Mar 14, 2017
.clang-format Add config for clang-format Oct 5, 2016
.gitignore Testing with vagrant for 6 OS and cmake+autoconf Oct 31, 2016
.travis.yml travis-ci: do not run coverage on osx Mar 12, 2017
.uncrustify Add config for uncrustify Oct 5, 2016
CMakeLists.txt cmake: eliminate EVENT_BUILDING_REGRESS_TEST, since we link with shar… Mar 13, 2017
CONTRIBUTING.md Add CONTRIBUTING.md (with checkpatch.sh examples) Oct 5, 2016
ChangeLog Update ChangeLog for 2.1.8-stable Jan 25, 2017
ChangeLog-1.4 Try to finalize changelog situation for 2.1.1-alpha Apr 3, 2012
ChangeLog-2.0 Update ChangeLog-2.0 Nov 18, 2012
Doxyfile Fix doxygen to use new macro conventions Feb 29, 2012
LICENSE Implement fast/precise monotonic clocks on Windows Apr 26, 2012
Makefile.am Include openssl-compat.h into dist archive Jan 29, 2017
Makefile.nmake Revert "The Windows socket type is defined as SOCKET." Dec 20, 2015
README.md cmake: fix export absolute path and relative path and cleanup a bit Mar 13, 2017
Vagrantfile Merge branch 'automake-tests-parallel-v4' (*includes ci bits also*) Jan 22, 2017
appveyor.yml appveyor: remove -DEVENT__ENABLE_VERBOSE_DEBUG=ON build Mar 12, 2017
arc4random.c Merge remote-tracking branch 'origin/patches-2.0' Aug 19, 2013
autogen.sh autogen.sh: learn about gmake Oct 31, 2016
buffer.c Use off_t instead of ev_off_t for sendfile() (fixes android build) Mar 8, 2017
buffer_iocp.c Have all visible internal function names end with an underscore. Feb 29, 2012
bufferevent-internal.h bufferevent: refactor to use type check macros Apr 13, 2017
bufferevent.c be: just a simple mistake, reinclude the <errno.h> Oct 4, 2016
bufferevent_async.c bufferevent: refactor to use type check macros Apr 13, 2017
bufferevent_filter.c bufferevent: refactor to use type check macros Apr 13, 2017
bufferevent_openssl.c Explicitly call SSL_clear when reseting the fd. Apr 21, 2017
bufferevent_pair.c bufferevent: refactor to use type check macros Apr 13, 2017
bufferevent_ratelim.c Pass and return const for bufferevent_get_token_bucket_cfg Jul 11, 2013
bufferevent_sock.c bufferevent: refactor to use type check macros Apr 13, 2017
changelist-internal.h Implemented EV_CLOSED event for epoll backend (EPOLLRDHUP). Jan 18, 2014
checkpatch.sh Add checkpatch script Oct 5, 2016
configure.ac Detect arch4random_addrandom() existence Mar 8, 2017
defer-internal.h Export symbols for -fvisibility=hidden (under cmake) Mar 13, 2017
devpoll.c Have all visible internal function names end with an underscore. Feb 29, 2012
epoll.c epoll: introduce PRINT_CHANGES() macro to avoid copy-pasting Nov 18, 2015
epoll_sub.c Merge remote-tracking branch 'origin/patches-2.0' Jan 22, 2014
epolltable-internal.h Split epoll lookup table into a separate header file Jan 21, 2014
evbuffer-internal.h Fix CVE-2014-6272 in Libevent 2.1 Jan 5, 2015
evconfig-private.h.cmake Generate a dummy evconfig-private.h so things build properly. Dec 13, 2013
evconfig-private.h.in Clean up lingering _identifiers. Feb 29, 2012
evdns.3 improved nroff mdoc for the man page Oct 15, 2006
evdns.c Fix -Werror=implicit-fallthrough (fixes gcc-7) Jan 29, 2017
event-config.h.cmake Fix arc4random_addrandom() detecting and fallback (regression) Mar 27, 2017
event-internal.h fix evutil_make_internal_pipe_'s comment that fd[0] for read and f[1]… Mar 18, 2017
event.3 Don't use BSD u_* types. Aug 25, 2015
event.c Make event_count macros cleaner Mar 26, 2017
event_iocp.c Merge remote-tracking branch 'origin/patches-2.0' Nov 1, 2013
event_rpcgen.py util-internal: fix __func__ redefinition (netbsd) Dec 6, 2016
event_tagging.c Export symbols for -fvisibility=hidden (under cmake) Mar 13, 2017
evmap-internal.h Have all visible internal function names end with an underscore. Feb 29, 2012
evmap.c Implemented EV_CLOSED event for epoll backend (EPOLLRDHUP). Jan 18, 2014
evport.c Have all visible internal function names end with an underscore. Feb 29, 2012
evrpc-internal.h Add an include to evrpc-internal to fix openbsd compilation warning Mar 12, 2014
evrpc.c Fix even more coverity warnings. Jan 8, 2014
evsignal-internal.h Add a new libevent_global_shutdown() to free all globals before exiting. Mar 22, 2012
evthread-internal.h cmake: Export missing symbols for win32 Mar 14, 2017
evthread.c Export symbols for -fvisibility=hidden (under cmake) Mar 13, 2017
evthread_pthread.c Clean up lingering _identifiers. Feb 29, 2012
evthread_win32.c Merge remote-tracking branch 'origin/patches-2.0' Dec 4, 2012
evutil.c fix evutil_make_internal_pipe_'s comment that fd[0] for read and f[1]… Mar 18, 2017
evutil_rand.c Detect arch4random_addrandom() existence Mar 8, 2017
evutil_time.c test: fix util/date_rfc1123 under win32 Dec 22, 2016
ht-internal.h ht-internal: don't reset hth_table_length explicitly in name_##HT_CLEAR Jan 8, 2015
http-internal.h Export symbols for -fvisibility=hidden (under cmake) Mar 13, 2017
http.c http: do not use local settings for Date header Dec 18, 2016
iocp-internal.h cmake: Export missing symbols for win32 Mar 14, 2017
ipv6-internal.h Convert include-guard macro convention to avoid reserved identifiers Feb 29, 2012
kqueue-internal.h Replace pipe-based notification with EVFILT_USER where possible Apr 11, 2012
kqueue.c Check for Mac OS X 10.4 kqueue bug properly Jul 12, 2016
libevent.pc.in Change use of AC_CHECK_LIB to AC_SEARCH_LIBS. Jul 10, 2009
libevent_core.pc.in libevent_core and libevent_extra also deserve a pkgconfig file Apr 20, 2016
libevent_extra.pc.in libevent_core and libevent_extra also deserve a pkgconfig file Apr 20, 2016
libevent_openssl.pc.in Use correct openssl libs and includes in pkgconfig file Nov 16, 2012
libevent_pthreads.pc.in Add pkgconfig files for libevent_{openssl,pthreads} Aug 10, 2010
listener.c listener: unlock lev on error in listener_read_cb() Mar 31, 2016
log-internal.h log/win32: fix exporting extern variable Mar 14, 2017
log.c log/win32: fix exporting extern variable Mar 14, 2017
make-event-config.sed Generate event-config.h with a single sed script Apr 27, 2012
make_epoll_table.py Implemented EV_CLOSED event for epoll backend (EPOLLRDHUP). Jan 18, 2014
minheap-internal.h Remove an unreachable return statement in minheap-internal.h Aug 1, 2013
mm-internal.h Export symbols for -fvisibility=hidden (under cmake) Mar 13, 2017
openssl-compat.h Unbreak build with LibreSSL after openssl 1.1 support added Jan 29, 2017
poll.c poll: Prevent libevent from spinning if POLLNVAL occurs Nov 4, 2016
ratelim-internal.h Have all visible internal function names end with an underscore. Feb 29, 2012
select.c Tweak the new evutil_weakrand_() code Apr 9, 2012
signal.c Merge remote-tracking branch 'github/20_win64_compilation' into 21_wi… Nov 2, 2012
strlcpy-internal.h Export symbols for -fvisibility=hidden (under cmake) Mar 13, 2017
strlcpy.c Fix all identifiers with names beginning with underscore. Feb 29, 2012
time-internal.h Export symbols for -fvisibility=hidden (under cmake) Mar 13, 2017
util-internal.h cmake: Export missing symbols for win32 Mar 14, 2017
whatsnew-2.0.txt "buffer" spelling Feb 8, 2013
whatsnew-2.1.txt Bump whatsnew-2.1 document Jan 25, 2017
whatsnew-2.2.txt Bump version in master to 2.2.0-alpha-dev Jan 29, 2017
win32select.c Don't use BSD u_* types. Aug 25, 2015

README.md

libevent logo

Appveyor Win32 Build Status Travis Build Status Coverage Status

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).

# 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 exectuables
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 encrpytion
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 crosscompiling 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: http://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 the 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 enviroment 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 http://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.

OpenSSL support

To build Libevent with OpenSSL support you will need to have OpenSSL binaries available when building, these can be found here: http://www.openssl.org/related/binaries.html

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 patchs via the mailing list.

Bugs, Features [RFC], and Issus: 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

If we have forgotten your name, please contact us.