1666 Commits

Author SHA1 Message Date
Nick Mathewson
1fdec20f8f Stop using global arrays to implement the EVUTIL_ctype functions
These apparently made libtool sad on win32, and the function call
overhead here should be negligable anyway.
2010-09-01 15:01:39 -04:00
Nick Mathewson
acc4aca49e Fix a bug in our win32 condition implementation
The do ... while loop in our wait code could spin while waiting
because the event object wasn't reset until there were no longer any
events waiting to be woken up.  We also want to reset the event object
if the count of events to wake up reaches zero.

Found by Chris Davis.  Fixes bug 3053358.
2010-08-30 11:35:06 -04:00
Nick Mathewson
d61b2f3386 Fix an issue with forking and signal socketpairs in select/poll backends
Nicholas Marriott identifies an issue where a signal socketpair
doesn't get recreated if the event backend doesn't set event_reinit.

See bug 3048812

There may be a similar issue with respect to th_notify_fd
2010-08-26 15:11:35 -04:00
Nick Mathewson
041989fb66 Rename regress_pthread.c to regress_thread.c 2010-08-24 12:42:24 -04:00
Nick Mathewson
f1074b776a Detect events with no ev_base; warn instead of crashing 2010-08-23 12:01:45 -04:00
Nick Mathewson
743f866539 Honor NDEBUG; build without warnings with NDEBUG; make NDEBUG always-off in unit test code 2010-08-23 11:49:06 -04:00
Nick Mathewson
970e6ad2ba Avoid deadlock when activating signals.
Fixes bug 3048812.

Based on patch by Nicholas Marriott.
2010-08-19 14:07:36 -04:00
Nick Mathewson
6123d1298f Fix kquue correctness test on x84_64
Apparently, in our configure.in check for a working kqueue, we were
leaving some fields unset that seemed to irritate 64-bit kqueue a lot.

Found by Christopher Layne
2010-08-19 09:43:04 -04:00
Nick Mathewson
4c32b9de2c Fix logic error in win32 TRY_LOCK that caused problems with rate-limiting 2010-08-18 12:02:25 -04:00
Nick Mathewson
d0b884338f Set close-on-exec bit for filedescriptors created by dns subsystem.
Based on patch for 1.4 by Ralf Schmitt.
2010-08-18 10:49:12 -04:00
Nick Mathewson
da6e7cd495 Correctly detect failure to delete bufferevent read-timeout event
Gilad Benjamini noted that we check the error code for deleting a
write-timeout event twice, and the read timeout not at all.  This
shouldn't be a bit problem, since it's really hard for a delete to
fail on a timeout-only event, but it's worth fixing.

Fixes bug 3046787
2010-08-17 13:26:03 -04:00
Nick Mathewson
5fb1095824 Add a unit test for conditions 2010-08-17 13:21:05 -04:00
Nick Mathewson
d74ae381e0 Make the regress_pthread.c tests work on windows with current test APIs 2010-08-17 13:21:05 -04:00
Nick Mathewson
e0972c2138 Use conditions instead of current_event_lock to fix a deadlock.
Avi Bab correctly noted as bug 3044479 the fact that any thread
blocking on current_event_lock will do so while holding
th_base_lock, making it impossible for the currently running event's
callback to call any other functions that require th_base_lock.

This patch switches the current_event_lock code to instead use a
condition variable that we wait on if we're trying to mess with
a currently-executing event, and that we signal when we're done
executing a callback if anybody is waiting on it.
2010-08-17 13:18:18 -04:00
Nick Mathewson
d4977b52f0 Add a condition variable backend, with implementations for pthreads and win32
The interface from the user's POV is similar to the locking
implementation: either provide a structure full of function
pointers, or just call evthread_use_*_threads() and everything will
be okay.

The internal interface is meant to vaguely resemble pthread_cond_*,
which Windows people will better recognize as *ConditionVariable*.
2010-08-17 13:15:34 -04:00
Gilad Benjamini
3920172821 Make definition of WIN32_LEAN_AND_MEAN in event.h conditional.
(Inclusion order might trigger a warning for redefinition on Windows.)
2010-08-13 17:19:18 -04:00
Gilad Benjamini
60433a0a1a Clean up syntax on TAILQ_ENTRY() usage
Though the C standards allow it, it's apparently possible to get MSVC
upset by saying "struct { int field; } (declarator);" instead of
"struct {int field; } declarator;", so let's just not do that.

Bugfix for 3044492

(commit msg by nickm)
2010-08-13 17:08:59 -04:00
Nick Mathewson
a4af9be10a Make include/event2/event-config.h not included in source dist
As a generated file, it shouldn't get included in our source
distribution.  Apparently there is an automake incant for this:
nobase_ even stacks with nodist_ .
2010-08-13 11:41:37 -04:00
Nick Mathewson
4022b287f8 Change include order in Makefile.nmake
If there is an event-config.h in include/event2 (either because we
screwed up packaging like in 2.0.6-rc or because we previously tried
building with mingw and we didn't make distclean in the middle), we
want MSVC to find the one one in WIN32-Code/include/event2 first.

Found by Gilad Benjamini.
2010-08-13 11:34:39 -04:00
Nick Mathewson
4991669b7c Update the whatsnew-2.0.txt document 2010-08-10 21:05:52 -04:00
Nick Mathewson
33200e72de Document that DNS_NO_SEARCH is an obsolete alias for DNS_QUERY_NO_SEARCH 2010-08-10 15:03:14 -04:00
Nick Mathewson
3808168d21 Completely remove the (mostly-removed) obsolete thread functions. 2010-08-10 15:02:50 -04:00
Nick Mathewson
9b5c19ac87 Merge branch 'more_pkgconfig' 2010-08-10 11:46:00 -04:00
Nick Mathewson
ebcb1f0387 Add pkgconfig files for libevent_{openssl,pthreads} 2010-08-10 11:11:25 -04:00
Nick Mathewson
0bffe43a15 Fix a nasty dangling-event bug when using rate-limiting groups
When we freed a bufferevent that was in a rate-limiting group and
blocked on IO, the process of freeing it caused it to get removed
from the group.  But removing the bufferevent from the group made
its limits get removed, which could make it get un-suspended and in
turn cause its events to get re-added.  Since we would then
immediately _free_ the events, this would result in dangling
pointers.

Fixes bug 3041007.
2010-08-09 12:08:40 -04:00
Nick Mathewson
ff481a8e43 Increment vesion to 2.0.6-rc-dev 2010-08-06 23:22:01 -04:00
Nick Mathewson
556d0f4001 Increment versions to 2.0.6-rc release-2.0.6-rc 2010-08-06 21:19:44 -04:00
Nick Mathewson
f658264041 Changlog and new acknowledgements for 2.0.6-rc 2010-08-06 21:11:01 -04:00
Nick Mathewson
ec347b9225 Move event-config.h to include/event2
This change means that all required include files are in event2, and
all files not in event2/* are optional.
2010-08-06 20:21:27 -04:00
Nick Mathewson
5fa30d2bf4 Fix evdns build with -DUNICODE
It turns out that GetProcAddress always takes its second argument as
a C string, regardless of whether unicode is on or not.
2010-08-06 17:13:27 -04:00
Nick Mathewson
28f31a4f8d Fix unit tests with -DUSE_DEBUG enabled
If you were to enable USE_DEBUG and slog through all 700+ MB of
debugging output, you'd find that one of the unit tests failed,
since it tested the debug logging code, but the string it expected
and the string it logged differed by a tab vs 2 spaces.
2010-08-06 16:36:23 -04:00
Nick Mathewson
ea1ea3d6ee Make test-changelist count cpu usage right on win32 2010-08-06 14:06:20 -04:00
Nick Mathewson
9b60209675 Use AF_INET socketpair to test sendfile on Solaris 2010-08-06 13:03:17 -04:00
Nick Mathewson
57b30cd7cc Turn our socketpair() replacement into its own function
This patch splits the formerly windows-only case of evutil_socketpair()
into an (internal-use-only) function named evutil_ersatz_socketpair(), and
makes it build and work right on non-Windows hosts.

We need this for convenience to test sendfile on solaris, where socketpair
can't give you an AF_INET pair, and sendfile() won't work on AF_UNIX.
2010-08-06 13:01:32 -04:00
Christopher Davis
de1f5d6d87 Remember to initialize timeout events for bufferevent_async
Fixes segfaults in unit tests.
2010-08-06 09:51:47 -04:00
Nick Mathewson
170ffd2b1d Increase the tolerance in our unit tests for sloppy clocks.
(Apparently openbsd in virtualbox just doesn't keep very accurate time.)
2010-08-05 15:57:30 -04:00
Nick Mathewson
e996b3d411 Make tests quieter on local dns resolver failure 2010-08-05 15:51:16 -04:00
Nick Mathewson
4558ce2322 Merge branch 'openssl_ratelim' 2010-08-04 17:31:28 -04:00
Nick Mathewson
b2c6202d65 Fix an assertion bug in test-ratelim
If the rate limit was low enough, then the echo_conns wouldn't finish
inside the 300 msec we allowed for them to close.  Instead, count the
number of connections we have, and keep waiting until they are all
closed.
2010-08-04 15:52:32 -04:00
Nick Mathewson
42f6b62414 Add option to test-ratelim to test min_share 2010-08-04 15:51:14 -04:00
Nick Mathewson
6ae53d6762 Add an interface to expose min_share in ratelimiting groups 2010-08-04 15:44:08 -04:00
Nick Mathewson
009f300532 Fix rate-limit calculation on openssl bufferevents.
When you're doing rate limiting on an openssl connection, you nearly
always want to limit the number of bytes sent and received over the
wire, not the number of bytes read or written over the secure
transport.
2010-08-04 14:54:38 -04:00
Trond Norbye
13b912e4ac Fixed compilation of sample/le-proxy.c on win32 2010-08-01 21:39:48 +02:00
Nick Mathewson
42a8c71112 Build more cleanly with NetBSDs that dislike toupper(char)
To be fair, when char can be signed, if toupper doesn't take negative
characters, toupper(char) is a very bad idea.  So let's just use the
nice safe EVUTIL_TOUPPER instead.  (It explicitly only upcases ASCII,
but we only use it for identifiers that we know to be ASCII anyway).
2010-07-31 17:10:04 -04:00
Joachim Bauch
840a72fbd5 Fix badly-behaved subtest of dns/bufferevent_connect_hostname
The bufferevent_connect_hostname test was specifying AF_INET, but the
gethostbyname test we were using to see what error to expect was using
PF_UNSPEC, leading to possible divergence of results.
2010-07-29 20:32:40 -04:00
Nick Mathewson
9e725f72e7 Improve error message for failed epoll to make debugging easier. 2010-07-29 18:12:04 -04:00
Nick Mathewson
cc2379d264 Constify a couple of arguments to evdns_server_request_add_*_reply 2010-07-26 14:48:32 -04:00
Nick Mathewson
e1c1167cbe Replace (unused,always 0) is_tcp argument to evdns_add_server_port*() with flags
Since we weren't using it for anything, and we always failed if it was
set, we're allowed to change the future semantics of setting it.
2010-07-22 14:44:24 +02:00
Nick Mathewson
7e87a599bb Stop asserting when asked for a (unsupported) TCP dns port. Just return NULL. 2010-07-21 14:33:42 +02:00
Mike Smellie
c991317409 Change bufferevent_openssl::do_write so it doesn't call SSL_write with a 0 length buffer
I was running into a problem when using bufferevent_openssl with a
very simple echo server.  My server simply bufferevent_read_buffer 'd
data into an evbuffer and then passed that evbuffer straight to
bufferevent_write_buffer.

The problem was every now and again the write would fail for no
apparent reason. I tracked it down to SSL_write being called with the
amount of data to send being 0.

This patch alters do_write in bufferevent_openssl so that it skips
io_vecs with 0 length.
2010-07-19 15:28:03 +02:00