895 Commits

Author SHA1 Message Date
Nick Mathewson
34c8f31650 Add deferred_cb_skew to list of timing-dependent tests 2012-08-02 12:36:05 -04:00
Nick Mathewson
403b0d6e02 Merge remote-tracking branch 'ppelleti/windows-ssl' 2012-07-31 12:03:48 -04:00
Nick Mathewson
9852107f37 Merge remote-tracking branch 'origin/patches-2.0'
Conflicts:
	buffer.c
	http.c
2012-07-26 10:43:13 -04:00
Nick Mathewson
a2006c0087 Move assignment outside tt_assert in ssl unit tests. Appeases coverity. 2012-07-26 10:37:47 -04:00
Nick Mathewson
b9e7329751 Add checks to various return values in unit tests. Found by coverity 2012-07-26 10:37:13 -04:00
Nick Mathewson
6355b2a4ca Remove unused variable; spotted by coverity 2012-07-26 10:16:47 -04:00
Nick Mathewson
225344cfac Fix a shadowed variable in addfile_test_readcb; found by coverity 2012-07-26 10:11:17 -04:00
Nick Mathewson
92817a11aa Avoid memory leak in test_event_calloc unit test; found by coverity 2012-07-26 10:11:00 -04:00
Nick Mathewson
aa501e1a7e Add checks for functions in test-ratelim.c; found by Coverity 2012-07-26 10:10:35 -04:00
Nick Mathewson
7ef04e4b48 Merge remote-tracking branch 'origin/patches-2.0'
Conflicts:
	configure.in
	test/regress_buffer.c
	test/regress_dns.c
2012-07-26 10:09:13 -04:00
Nick Mathewson
3cde5bf57a Avoid more crashes/bad calls in unit tests; found by coverity 2012-07-26 10:04:43 -04:00
Nick Mathewson
f021c3d762 Add some missing null checks to unit tests; found by coverity 2012-07-26 09:59:47 -04:00
Nick Mathewson
270f279fb5 Fix resource leaks in the unit tests; found by coverity 2012-07-26 09:53:20 -04:00
Nick Mathewson
4f3732d75e Fix various check-after-dereference issues in unit tests: found by coverity 2012-07-26 09:35:43 -04:00
Nick Mathewson
f1ce15d936 Set umask before calling mkstemp in unit tests. Found by coverity 2012-07-25 16:18:33 -04:00
Nick Mathewson
13525c50eb Fix another possible uninitialized read in dns regression tests. Found by coverity. 2012-07-25 16:07:22 -04:00
Nick Mathewson
6fdbf3a2bc Merge remote-tracking branch 'origin/patches-2.0' 2012-07-25 16:06:51 -04:00
Nick Mathewson
2259777cc8 Fix possible uninitialized read in dns regression tests. Found by coverity. 2012-07-25 16:05:36 -04:00
Nick Mathewson
555334670a Remove deadcode in http regression tests. Found by coverity. 2012-07-25 15:59:50 -04:00
Nick Mathewson
52a0039ba1 Fix tinytset_skip to work with new tinytest_set_flag_ signature 2012-07-20 15:36:15 -04:00
Patrick Pelletier
eba0eb2e71 attempt to support OpenSSL in Makefile.nmake 2012-07-03 22:50:24 -07:00
Nick Mathewson
2b6fe8bb7f Make load-dependent monotonic timer tests off-by-default
You can reenable them with @all, or say @fine_timing just to get
them.
2012-06-29 12:47:51 -04:00
Nick Mathewson
5671033752 Avoid (unlikely) overflow in bench_httpclient.c 2012-06-29 12:47:39 -04:00
Nick Mathewson
c8009d2985 Check return value of write() in regress.c 2012-06-29 12:47:03 -04:00
Nick Mathewson
f2cea873bb Make all tests that hit the network disabled by default
To run only these tests, run test/regress with @live_net.  To run all
tests, run test/regress with @all.
2012-06-28 13:18:28 -04:00
Nick Mathewson
ef7c4f7956 Update to latest tinytest (911b4f0349377) 2012-06-28 12:58:46 -04:00
Nick Mathewson
def3b83419 Make test_evutil_monotonic a little more tolerant 2012-06-28 12:57:58 -04:00
Nick Mathewson
108896abcc Merge branch 'master' of ssh://github.com/libevent/libevent 2012-06-28 11:42:25 -04:00
Nick Mathewson
e2d7d98d9d remove a now-unused var in thread_deferred_cb_skew test 2012-06-28 11:37:45 -04:00
Nick Mathewson
8a739b3492 Merge branch '21_event_callback_v3' 2012-06-28 11:36:52 -04:00
Nick Mathewson
ea92fba36c Avoid a resource leak on error in http client benchmark 2012-06-25 13:55:45 -04:00
Nick Mathewson
90daab6184 Merge remote-tracking branch 'origin/patches-2.0' 2012-06-06 17:06:57 -04:00
Ross Lagerwall
3b2529acf2 Fix a couple of memory leaks (found with Valgrind). 2012-06-06 21:57:12 +02:00
Ross Lagerwall
3881d8fdf6 Fix a comment in test-fdleak after 077c7e949. 2012-06-03 15:19:53 +02:00
Nick Mathewson
c0e425abdc Restore our priority-inversion-prevention code with deferreds
Back when deferred_cb stuff had its own queue, the queue was always
executed, but we never ran more than 16 callbacks per iteration.
That made for two problems:

1: Because deferred_cb stuff would always run, and had no priority,
it could cause priority inversion.

2: It doesn't respect the max_dispatch_interval code.

Then, when I refactored deferred_cb to be a special case of
event_callback, that solved the above issues, but made for two more
issues:

3: Because deferred_cb stuff would always get the default priority,
it could could low-priority bufferevents to get too much priority.

4: With code like bufferevent_pair, it's easy to get into a
situation where two deferreds keep adding one another, preventing
the event loop from ever actually scanning for more events.

This commit fixes the above by giving deferreds a better notion of
priorities, and by limiting the number of deferreds that can be
added to the _current_ loop iteration's active queues.  (Extra
deferreds are put into the active_later state.)

That isn't an all-purpose priority inversion solution, of course: for
that, you may need to mess around with max_dispatch_interval.
2012-05-09 12:06:00 -04:00
Nick Mathewson
a4079aa88a Replace more deferred_cb names with event_callback 2012-05-09 12:05:59 -04:00
Nick Mathewson
ae2b84b257 Replace deferred_cbs with event_callback-based implementation. 2012-05-09 12:05:53 -04:00
Nick Mathewson
745a63dba3 Add "active later" event_callbacks to supersede deferred
An event or event callback can now be in an additional state: "active
later".  When an event is in this state, it will become active the
next time we run through the event loop.  This lets us do what we
wanted to with deferred callbacks: make a type of active thing that
avoids infinite circular regress in a way that starves other events or
exhausts the stack.  It improves on deferred callbacks by respecting
priorities, and by having a non-kludgy way to avoid event starvation.
2012-05-09 12:05:53 -04:00
Nick Mathewson
e0aa08666e Merge remote-tracking branch 'github/patches-2.0'
Conflicts:
	test/regress.c
2012-05-03 12:21:57 -04:00
Nick Mathewson
e06206ebd8 Oops; fix the *right* windows compile issue 2012-05-03 12:15:11 -04:00
Nick Mathewson
be7a0be816 Fix win32 build issues: sleep, pid_t 2012-05-03 12:05:52 -04:00
Nick Mathewson
a163026099 Merge branch '21_robust_monotonic' 2012-05-01 13:22:56 -04:00
Nick Mathewson
2e882a071b Merge remote-tracking branch 'origin/patches-2.0'
Conflicts:
	event.c
2012-04-30 22:00:05 -04:00
Nick Mathewson
30f0671526 Merge remote-tracking branch 'github/20_active_prio_inv' into patches-2.0 2012-04-30 21:45:43 -04:00
Nick Mathewson
b3887cdf3b Work-around a stupid gcov-breaking bug in OSX 10.6
This only affects the unit tests.

Fix found at http://rachelbythebay.com/w/2011/07/12/forkcrash/

(Backport from 2.1)
2012-04-30 21:17:26 -04:00
Nick Mathewson
2bfda4012c If a higher-priority event becomes active, don't continue running events of the current priority.
Bug found by Ralph Castain.
2012-04-30 17:30:48 -04:00
Nick Mathewson
26c75828b7 When PRECISE_TIMERS is set with epoll, use timerfd for microsecond precision
The epoll interface ordinarily gives us one-millisecond
precision, so on Linux it makes perfect sense to use the
CLOCK_MONOTONIC_COARSE timer.  But when the user has set the new
PRECISE_TIMER flag for an event_base (either by the
EVENT_BASE_FLAG_PRECISE_TIMER flag, or by the EVENT_PRECISE_TIMER
environment variable), they presumably want finer granularity.

On not-too-old Linuxes, we can achieve this using the Timerfd
mechanism, which accepts nanosecond granularity and understands
posix clocks.  It's a little more expensive than just calling
epoll_wait(), so we won't do it by default.
2012-04-26 16:42:21 -04:00
Nick Mathewson
7428c78a95 Improve the monotonic-time unit test: make it check the step size 2012-04-26 16:42:21 -04:00
Nick Mathewson
630f077c29 Simple unit tests for monotonic timers 2012-04-26 16:42:21 -04:00
Nick Mathewson
71bca50f12 Split out time-related prototypes into time-internal.h 2012-04-20 12:27:12 -04:00