Nick Mathewson [Thu, 16 Dec 2010 19:25:04 +0000 (14:25 -0500)]
Clean up error handling in epoll_apply_one_change() a little
The old code was more or less:
if (op == X && errno == FOO) {
...
} else if (op == Y && errno == BAR) {
...
}
but really we wanted to do a switch (op) to avoid needless checks
and branches.
This patch leaves the indentation a little weird so as to make it
easier to see what changed; the next patch will fix the indentation.
Nick Mathewson [Thu, 2 Sep 2010 21:52:20 +0000 (17:52 -0400)]
Use GetSystemTimeAsFileTime to implement gettimeofday on win32.
It is (in my benchmarks) way faster than _ftime, though the
conversion process is not so straightforward. In theory, it can
have a better granularity too, though in practice who knows what
you're getting.
Mike Smellie [Mon, 19 Jul 2010 02:18:31 +0000 (14:18 +1200)]
Use current event set rather than current pending change when deciding whether to no-op a del
This alters event_changelist_del to quash deletion of events that
didn't exist in the first place.
As far as I can see, the add,delete, dispatch case described in the
original comment will never happen. The recorded change is a single
operation, not a queue. This seems to leave actions to delete
events that never existed as the real targets for no-oping
Nick Mathewson [Tue, 30 Nov 2010 03:44:18 +0000 (22:44 -0500)]
Try to fix an assertion failure related to close detection
f700566c removed a line from evhttp_connection_stop_detectclose that
cleared the EVHTTP_CON_CLOSEDETECT flag. I think this was an
accident, and suspect that it may be the cause of bug 3069555.
Add evhttp server alias interface, correct flagging of proxy requests.
evhttp needs to be mindful of all hostnames and addresses that clients
use to contact the main server and vhosts to know the difference between
proxy requests and non-proxy requests.
Kevin Bowling [Tue, 23 Nov 2010 03:44:10 +0000 (20:44 -0700)]
select comes from <sys/select.h> according to POSIX.1-2001, or from a
variety of other standard headers on older systems, but not <select.h>.
AIX build fix.
Nick Mathewson [Wed, 24 Nov 2010 01:31:28 +0000 (20:31 -0500)]
Handle evhttp PUT/POST requests with an empty body
When we call evhttp_get_bodylen() [when transfer-encoding isn't set],
having req->ntoread == -1 means that we have no content-length. But a
request with no content-length has no body! We were treating the
absent content-length as meaning "read till closed", which only holds
for replies, not requests.
This patch also allows PATCH requests to have a body.
Nick Mathewson [Mon, 22 Nov 2010 19:10:01 +0000 (14:10 -0500)]
Make unit tests for epoll-with-changelist pass
The only changes needed were to handle the fact that the methodname
"epoll (with changelist)" matches the environment variable
EVENT_NOEPOLL rather than the imaginary "EVENT_EPOLL (WITH CHANGELIST)".
Nick Mathewson [Mon, 15 Nov 2010 00:52:18 +0000 (19:52 -0500)]
Fix bug in bufferevent_connect on an openssl bufferevent that already had an fd
The problem was that we were using openssl's BIO code's shutdown flag
whenever BEV_OPT_CLOSE_ON_FREE was set. This made the BIO close the
socket when it was freed... but it would be freed whenever we did a
setfd on the bufferevent_openssl, even the no-op setfd in
bufferevent_connect.
So instead, we just set the shutdown flag to 0, and handle closing the
fd ourselves.
Nick Mathewson [Mon, 15 Nov 2010 00:25:54 +0000 (19:25 -0500)]
Make EVLOOP_ONCE ignore internal events
Merely getting an internal notification event from having an event
added or deleted from another thread should not cause
event_base_loop(base, EVLOOP_ONCE) to exit; previously, it did.
Nick Mathewson [Tue, 9 Nov 2010 16:43:47 +0000 (11:43 -0500)]
When closing a filtering bufferevent, clear callbacks on the underlying bufferevent
Previously, if BEV_OPT_CLOSE_ON_FREE wasn't set on a
bufferevent_filter or a filtering bufferevent_openssl, when we went
to free the filtering bufferevent, we'd leave the underlying
bufferevent unchanged. That's not so good, since the callbacks are
set to activate stuff in the filtering bufferevent that we're about
to free. Instead, set all the callbacks to NULL.