Nick Mathewson [Tue, 6 Aug 2013 23:06:58 +0000 (19:06 -0400)]
Add some assertions to please coverity.
In event_process_active_single_queue, EVLIST_INIT must be set on any
event that uses one of the event-only closures, and so "ev" will be
set in those cases. But coverity's worried here (CIDs numerous). So
instead, just add the assertions that should make it happy.
Maxime Henrion [Wed, 31 Jul 2013 15:02:07 +0000 (15:02 +0000)]
Add checks for evhttp_connection_get_server() in unit tests.
They validate that this function behave as expected; that is, it returns
NULL for outgoing connections, and returns the HTTP server object that
received the connection for incoming ones.
Azat Khuzhin [Fri, 10 May 2013 23:53:11 +0000 (03:53 +0400)]
Fix SEGFAULT after evdns_base_resume if no nameservers installed.
If there is no nameservers installed, using
evdns_base_nameserver_ip_add(), than evdns_base_resume() will SEGFAULT,
because of NULL dereference in evdns_requests_pump_waiting_queue()
Maxime Henrion [Thu, 16 May 2013 16:38:39 +0000 (16:38 +0000)]
If evsel->del() fails, don't leave the evmap in an inconsistent state.
This fixes assertion failures in cases where epoll() fails with EBADF
-- the root cause for which is as of yet unknown. It seems something
(OpenSSL?) is closing the file descriptor under our feet.
Azat Khuzhin [Mon, 13 May 2013 19:50:30 +0000 (19:50 +0000)]
Fix dns/leak_resume_send_err test.
Because we don't cancel request,
and want our callback to recieve DNS_ERR_SHUTDOWN,
we use deferred callback, and there was
- one extra malloc(),
@see reply_schedule_callback()
- and one missing free
@see request_finished() (req->handle->pending_cb = 1)
than we don't need to count in testleak_cleanup()
So just decrement allocated_chunks to 2,
like we already take care about it.
Azat Khuzhin [Fri, 10 May 2013 23:53:11 +0000 (03:53 +0400)]
Fix SEGFAULT after evdns_base_resume if no nameservers installed.
If there is no nameservers installed, using
evdns_base_nameserver_ip_add(), than evdns_base_resume() will SEGFAULT,
because of NULL dereference in evdns_requests_pump_waiting_queue()
Nick Mathewson [Wed, 10 Apr 2013 01:14:52 +0000 (21:14 -0400)]
Always run pending finalizers when event_base_free() is called
There was actually a bug in the original version of this: it tried to
run the finalizers after (potentially) setting current_base to NULL;
but those finalizers could themselves (potentially) be invoking stuff
that needed to know about the current event_base. So the right time to
do it is _before_ clearing current_base.
Nick Mathewson [Tue, 9 Apr 2013 22:16:13 +0000 (18:16 -0400)]
Use finalization feature so bufferevents can avoid deadlocks
Since the bufferevents' events are now EV_FINALIZE (name pending),
they won't deadlock. To clean up properly, though, we must use the
finalization feature.
This patch also split bufferevent deallocation into an "unlink" step
that happens fast, and a "destruct" step that happens after
finalization.
More work is needed: there needs to be a way to specify a finalizer
for the bufferevent's argument itself. Also, this finalizer business
makes lots of the reference counting we were doing unnecessary.
Nick Mathewson [Fri, 26 Apr 2013 16:12:08 +0000 (12:12 -0400)]
Make all tests pass under EVENT_DEBUG_MODE=1
The fix was easy: the tests that were failing were those tests that
also enabled debug mode themselves. So, let them know when
EVENT_DEBUG_MODE is on, so they won't do that.
Azat Khuzhin [Thu, 21 Mar 2013 09:55:40 +0000 (13:55 +0400)]
Add new error_cb for actual reporting of HTTP request errors.
It is useful to know why you callback called with NULL (i.e. it failed),
for example if you set max_body with evhttp_connection_set_max_body_size()
you must know that it failed because of body was longer than this size.
Azat Khuzhin [Wed, 27 Mar 2013 16:15:46 +0000 (20:15 +0400)]
evdns: New flag to make evdns not prevent the event loop from exiting
Here is the brief description of problem:
When you are use evdns to resolve domains to IP adresses (see
./sample/dns-example) you loop never returns from event_base_dispatch(),
and because of this the program will never terminated.
Because existing programs may be depending on the old behavior, we
only apply the fix when evdns_base_new() is created with a new flag -
EVDNS_BASE_DISABLE_WHEN_INACTIVE.
(Commit message edited by Nick while squashing the branch.)