3247 Commits

Author SHA1 Message Date
Nick Mathewson
867f401f9b Fix a pile of coverity warnings in the unit tests
Most of these problems can only trigger when the tests fail, but it's
good hygiene to keep the code warning-free in any case.
2014-01-08 11:51:22 -05:00
Nick Mathewson
8d15f57f61 Merge remote-tracking branch 'asweeny86/on-complete-cb' 2014-01-07 16:59:26 -05:00
Andrew Sweeney
b85f398704 Update unit test to make sure that the callback happens after the output data is written 2014-01-06 21:19:15 -05:00
Andrew Sweeney
da86dda951 evhttp_request_set_on_complete_cb to be more specific about what the function actually does and usage 2014-01-06 20:36:31 -05:00
Nick Mathewson
f9e091bf4e Merge remote-tracking branch 'asweeny86/event-count-max' 2014-01-06 12:11:30 -05:00
Andrew Sweeney
b083ca0551 Provide on request complete callback facility
This patch provides the ability to receive a callback on the completion of a
request.  The callback takes place immediately before the request's resources
are released.
2014-01-05 20:35:46 -05:00
Andrew Sweeney
26230a2d21 Added unit test for max event counts 2014-01-05 16:30:35 -05:00
Andrew Sweeney
efbd3dcf28 Fixed bug using wrong variable in max event compare 2014-01-05 16:29:52 -05:00
Andrew Sweeney
5173bef50f Add access to max event count stats
This commit provides an interface for accessing and resetting the maximum
number of events in a given period.  This information provides better insight
into event queue pressure.
2013-12-30 14:06:20 -05:00
Nick Mathewson
4c8ebcd359 Remove unneeded declaration in bufferevent-internal.h 2013-12-24 15:02:02 -05:00
Nick Mathewson
254c04ec4b Fix needless bufferevent includes in evdns.c 2013-12-24 15:01:34 -05:00
Nick Mathewson
88ecda3bbb Fix a couple of "#ifdef WIN32" instances 2013-12-24 14:37:30 -05:00
Nick Mathewson
d1976f8ec4 Sample HTTPS Client: Set hostname for SNI extension (by f69m)
Patch from f69m on SourceForge
2013-12-24 14:05:44 -05:00
Antony Antony
62f596b7f4 fix for ServFail from RIPE Atlas release 2013-12-24 14:03:46 -05:00
Nick Mathewson
90786eb073 Small tweaks to https-client.c 2013-12-24 12:59:36 -05:00
Nick Mathewson
2fbc3b148b Merge remote-tracking branch 'resetius/https' 2013-12-24 12:45:22 -05:00
Nick Mathewson
471fbe3baf Merge remote-tracking branch 'rbalint/from-forked-daapd' 2013-12-24 12:27:24 -05:00
Nick Mathewson
a3172a415b Minor optimizations on bufferevent_trigger options
By making BEV_TRIG_DEFER_CALLBACKS equal to BEV_OPT_DEFER_CALLBACKS,
and BEV_TRIG_IGNORE_WATERMARKS disjoint from BEV_OPT_*, we can save a
few operations in bufferevent_run_*, which is critical-path.
2013-12-24 11:30:06 -05:00
Nick Mathewson
4dd3abd41f Make bufferevent_trigger_nolock_() inline
Since most of its callers are using constant EV_READ or EV_WRITE, and
using constant 0 as its argument, this should eliminate most of the
overhead for this function in the fast case.
2013-12-24 11:20:52 -05:00
Nick Mathewson
b4ef3def6f Merge remote-tracking branch 'mistotebe/bufferevent_trigger' 2013-12-24 10:33:58 -05:00
Nick Mathewson
87fa2b004a Unit tests for active_by_fd; unsupport active_by_fd(TIMEOUT)
[It turns out that event_base_active_by_fd(TIMEOUT) didn't actually
work right. Feel free to add it back in as a patch.]
2013-12-23 20:46:38 -05:00
Nick Mathewson
486594337a Add event_base_active_by_signal by analogy 2013-12-21 23:32:10 -05:00
Nick Mathewson
5c9da9a8a8 Sanity-check arguments to event_base_active_by_fd() 2013-12-21 23:21:33 -05:00
Nick Mathewson
93369ff4e9 Merge remote-tracking branch 'ghazel/event_base_active_by_fd' 2013-12-21 23:15:41 -05:00
Nick Mathewson
974c60e14a Refactor evmap_{io,signal}_active_() to tolerate bad inputs 2013-12-21 23:15:28 -05:00
Nick Mathewson
db7acd1310 Merge remote-tracking branch 'origin/patches-2.0' 2013-12-20 13:37:39 -05:00
Nick Mathewson
eaa79cd459 Merge remote-tracking branch 'sourceforge/patches-2.0' into patches-2.0
Conflicts:
	include/event2/event.h
2013-12-20 13:37:04 -05:00
Nick Mathewson
8cd695bf6d Typo fixes from Linus Nordberg 2013-12-20 13:35:03 -05:00
Nick Mathewson
cec62cb80a Typo fixes from Linus Nordberg 2013-12-20 13:31:29 -05:00
Joakim Soderberg
dd413bd19b Added EVENT__ENABLE_GCC_WARNINGS, turns all warnings into errors. 2013-12-19 12:03:49 +00:00
Joakim Soderberg
f7805939d1 Only look for ZLib when it is used (if tests are included).
Also make the project language C.
2013-12-19 10:46:04 +00:00
Joakim Soderberg
4ac086abc4 Fix the "make verify" target on NetBSD 2013-12-19 10:54:52 +01:00
Joakim Soderberg
f2483f8b3d Add a "make verify_coverage" target generation coverage info.
Use lcov/gcov to gather coverage info for the tests (Only works with gcc/clang and make).

cmake -DEVENT__COVERAGE=1 -DCMAKE_BUILD_TYPE=Debug ..
make
make verify_coverage

Current coverage (run on debian):
Line coverage 79.1 %	10231 / 12939
Function coverage 86.1 %	933 / 1083
2013-12-17 15:17:29 +00:00
Joakim Soderberg
0ef1d04e44 Get rid of unknown pragma warnings. 2013-12-17 14:32:07 +01:00
Joakim Soderberg
968e97bd4b Minimum required python version is 2.4.
Got rid of TODO... The version you specify to find_package is the minimum
version, so exactly what we want.
2013-12-17 14:31:22 +01:00
Joakim Soderberg
86df3edaa0 Change the BSD license from 4 to 3-clause.
This makes it GPL compatible. Changing the license from 4 to 3-clause BSD
license is OK according to a Berkley announcement on July 22, 1999 by
William Hoskins, the director of the fofice of technology licensing for
Berkley:

ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
2013-12-17 14:07:14 +01:00
Joakim Söderberg
2799b359d3 Added a test for testing if kqueue works with pipes. 2013-12-17 14:01:21 +01:00
Joakim Söderberg
a831f2f7de Fix kqueue support. 2013-12-17 13:29:04 +01:00
Joakim Söderberg
69c3516be6 Get rid of deprecation warnings for OpenSSL on OSX 10.7+ 2013-12-17 13:28:23 +01:00
Joakim Soderberg
67e5d74983 Fix the make "verify" target on Windows.
Windows does not have the "unset" command, but this doesn't matter since
the problem that requires us to use unset doesn't happen on Windows.

Also did some minor cosmetic changes, and dependcy changes.
2013-12-16 18:10:32 +01:00
Nick Mathewson
031a803071 Clarify event_base_loop exit conditions 2013-12-16 12:02:21 -05:00
Joakim Soderberg
e053c4f029 Added a "make verify" target.
This is more than for cosmetic purposes to match how it's done with autoconf.

Due to the fact that we use environment variables to turn off certain backends during the tests, simply running "ctest" or "make test" can result in failed tests.

This is because if you do "EVENT_NOEPOLL=yes && export EVENT_NOEPOLL" and then run the tests, when running the epoll tests, the EPOLL backend will be turned off. There is no way of unsetting an environment variable for a test in CMake, you can only set them. And since libevent simply checks if the environment variable is set (it doesn't check the actual value of it), this won't work.

So to remedy this, we create the "make verify" target that first unsets all the EVENT_NO* environment variables, and then runs ctest.

Also bumped the required CMake version from 2.6 to 2.8, since the set_test_properties(bla PROPERTIES ENVIRONMENT "SOME_VAR") requires 2.8

Added some explicit dependencies for the test programs to libevent, so they don't just fail if you try to run the tests without first doing "make"
2013-12-16 16:44:13 +00:00
Joakim Soderberg
7ea4159d29 Only test the event backends available on the system.
Fix how the CMake project adds the tests using the different backends. At
first we tried to do it exactly as it's done in test/test.sh.

However, test.sh uses a special program test-init to decide if a given
backend is available or not before running the actual tests. Doing it this way
will not be possible using CMake. Since then we would have to have the
test-init executable compiled at the time we run CMake, to know what tests
we should add. (And since CMake generates the make/project files that
compiles the executables, there's a catch 22).

Instead of deciding what tests to run this way, we simply use the result
of the CMake system introspection (that figures out what backends are
available) to decide what backend tests to add.
2013-12-16 16:37:51 +01:00
Joakim Soderberg
8f2af50f38 Don't segfault on no found event backend. 2013-12-16 13:45:45 +01:00
Joakim Soderberg
78da644f3d Fix bench_cascade program on Windows. 2013-12-16 11:35:31 +01:00
Joakim Soderberg
9bbce0b63c Only include WIN32 getopt where it is used.
getopt is only used in the benchmark tests, don't include it in the core
lib...
2013-12-16 11:34:14 +01:00
Joakim Soderberg
c259d53c82 Add copyright and licensing files for CMake modules. 2013-12-16 11:27:13 +01:00
Joakim Soderberg
dbf2b5171a Use evutil_closesocket instead. 2013-12-16 11:26:29 +01:00
Joakim Soderberg
19222e5247 Added some GCC specific options.
- Added sample applications.
- Fixed the https-client to work on Windows kind of (No cert validation).
2013-12-13 16:27:10 +00:00
Joakim Soderberg
58fcd42880 Link libm on unix platforms. 2013-12-13 12:39:50 +00:00