]> granicus.if.org Git - libevent/log
libevent
14 years agoFix evdns build with -DUNICODE
Nick Mathewson [Fri, 6 Aug 2010 21:13:27 +0000 (17:13 -0400)]
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.

14 years agoFix unit tests with -DUSE_DEBUG enabled
Nick Mathewson [Fri, 6 Aug 2010 20:36:23 +0000 (16:36 -0400)]
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.

14 years agoMake test-changelist count cpu usage right on win32
Nick Mathewson [Fri, 6 Aug 2010 17:34:51 +0000 (13:34 -0400)]
Make test-changelist count cpu usage right on win32

14 years agoUse AF_INET socketpair to test sendfile on Solaris
Nick Mathewson [Fri, 6 Aug 2010 17:03:17 +0000 (13:03 -0400)]
Use AF_INET socketpair to test sendfile on Solaris

14 years agoTurn our socketpair() replacement into its own function
Nick Mathewson [Fri, 6 Aug 2010 17:01:32 +0000 (13:01 -0400)]
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.

14 years agoRemember to initialize timeout events for bufferevent_async
Christopher Davis [Fri, 6 Aug 2010 13:33:55 +0000 (09:33 -0400)]
Remember to initialize timeout events for bufferevent_async

Fixes segfaults in unit tests.

14 years agoIncrease the tolerance in our unit tests for sloppy clocks.
Nick Mathewson [Thu, 5 Aug 2010 19:57:30 +0000 (15:57 -0400)]
Increase the tolerance in our unit tests for sloppy clocks.

(Apparently openbsd in virtualbox just doesn't keep very accurate time.)

14 years agoMake tests quieter on local dns resolver failure
Nick Mathewson [Thu, 5 Aug 2010 19:51:16 +0000 (15:51 -0400)]
Make tests quieter on local dns resolver failure

14 years agoMerge branch 'openssl_ratelim'
Nick Mathewson [Wed, 4 Aug 2010 21:31:28 +0000 (17:31 -0400)]
Merge branch 'openssl_ratelim'

14 years agoFix an assertion bug in test-ratelim
Nick Mathewson [Wed, 4 Aug 2010 19:52:32 +0000 (15:52 -0400)]
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.

14 years agoAdd option to test-ratelim to test min_share
Nick Mathewson [Wed, 4 Aug 2010 19:51:14 +0000 (15:51 -0400)]
Add option to test-ratelim to test min_share

14 years agoAdd an interface to expose min_share in ratelimiting groups
Nick Mathewson [Wed, 4 Aug 2010 19:44:08 +0000 (15:44 -0400)]
Add an interface to expose min_share in ratelimiting groups

14 years agoFix rate-limit calculation on openssl bufferevents.
Nick Mathewson [Wed, 4 Aug 2010 18:54:38 +0000 (14:54 -0400)]
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.

14 years agoFixed compilation of sample/le-proxy.c on win32
Trond Norbye [Sun, 1 Aug 2010 19:39:48 +0000 (21:39 +0200)]
Fixed compilation of sample/le-proxy.c on win32

14 years agoBuild more cleanly with NetBSDs that dislike toupper(char)
Nick Mathewson [Sat, 31 Jul 2010 21:10:04 +0000 (17:10 -0400)]
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).

14 years agoFix badly-behaved subtest of dns/bufferevent_connect_hostname
Joachim Bauch [Fri, 30 Jul 2010 00:32:40 +0000 (20:32 -0400)]
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.

14 years agoImprove error message for failed epoll to make debugging easier.
Nick Mathewson [Thu, 29 Jul 2010 22:12:05 +0000 (18:12 -0400)]
Improve error message for failed epoll to make debugging easier.

14 years agoConstify a couple of arguments to evdns_server_request_add_*_reply
Nick Mathewson [Mon, 26 Jul 2010 18:48:32 +0000 (14:48 -0400)]
Constify a couple of arguments to evdns_server_request_add_*_reply

14 years agoReplace (unused,always 0) is_tcp argument to evdns_add_server_port*() with flags
Nick Mathewson [Thu, 22 Jul 2010 12:38:08 +0000 (14:38 +0200)]
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.

14 years agoStop asserting when asked for a (unsupported) TCP dns port. Just return NULL.
Nick Mathewson [Wed, 21 Jul 2010 12:33:42 +0000 (14:33 +0200)]
Stop asserting when asked for a (unsupported) TCP dns port. Just return NULL.

14 years agoChange bufferevent_openssl::do_write so it doesn't call SSL_write with a 0 length...
Mike Smellie [Mon, 19 Jul 2010 03:31:19 +0000 (15:31 +1200)]
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.

14 years agoMake test/test.sh call test-changelist
Nick Mathewson [Mon, 19 Jul 2010 13:14:10 +0000 (15:14 +0200)]
Make test/test.sh call test-changelist

Eventually test-changelist should expand to try more cases, maybe
query the status of the actual changelist somehow, and integrate it
with the rest of the unit tests.

Also, add test-changelist to gitignore.

14 years agoFix whitespace.
Nick Mathewson [Mon, 19 Jul 2010 13:03:43 +0000 (15:03 +0200)]
Fix whitespace.

14 years agoRemove unused variables in test/test-changelist.c
Nick Mathewson [Mon, 19 Jul 2010 12:58:08 +0000 (14:58 +0200)]
Remove unused variables in test/test-changelist.c

14 years agoPossible fix to 100% cpu usage with epoll and openssl
Mike Smellie [Mon, 19 Jul 2010 01:44:56 +0000 (13:44 +1200)]
Possible fix to 100% cpu usage with epoll and openssl

I'm running a fairly simple bit of test code using libevent2 with epoll and
openssl bufferevents and I've run into a 100% cpu usage problem.

Looking into it 100% usage was caused by epoll_wait constantly
returning write events on the openssl socket when it shouldn't really have
been looking for write events at all (N_ACTIVE_CALLBACKS() was returning 0
also).

Looking a bit deeper eventbuffer_openssl socket seems to be requesting
that the EV_WRITE event be removed when it should, but the event isn't
actually being removed from epoll.

Continuing to follow this I think I've found a bug in
event_changelist_del.

For evpoll event_del calls event_changelist_del which caches the change
which is then actioned later when evpoll_dispatch is called.

In event_changlist_del there is a check so that if the currently changed
action is an add then the cached action is changed to a no-op rather than a
delete (which makes sense). The problem arises if there are more than
two add or delete operations between calls to dispatch, in this case it's
possible that the delete is turned into a no-op when it shouldn't have
been.

For example starting with the event on, a delete followed by an add and
then another delete results in a no-op when it should have been a delete (I
added a fair bit of debug output that seems to confirm this behaviour).

I've applied a small change that checks the original old_event stored with
the change and only converts the delete to a no-op if the event isn't on in
old_event. This seems to have fixed my problem.

14 years agoMerge branch 'pncalls_fix'
Nick Mathewson [Fri, 16 Jul 2010 16:38:23 +0000 (12:38 -0400)]
Merge branch 'pncalls_fix'

14 years agoFix wrong sie calculation of iovec buffers when exact=1
niks [Fri, 16 Jul 2010 13:11:09 +0000 (09:11 -0400)]
Fix wrong sie calculation of iovec buffers when exact=1

The old code had a bug where the 'exact' flag to 1 in
_evbuffer_read_setup_vecs would never actually make the iov_len field
of the last iovec get truncated.  This patch fixes that.

14 years agoPass flags to fcntl(F_SETFL) and fcntl(F_SETFD) as int, not long
Nick Mathewson [Tue, 13 Jul 2010 15:06:08 +0000 (11:06 -0400)]
Pass flags to fcntl(F_SETFL) and fcntl(F_SETFD) as int, not long

Everybody but Linux documents this as taking an int, and Linux is
very tolerant of getting an int instead.  If it weren't, everybody
doing fcntl(fd,F_SETFL,O_NONBLOCK) would break, since the glibc
headers define O_NONBLOCK as an int literal.

14 years agoSuppress a spurious EPERM warning in epoll.c
Nick Mathewson [Thu, 8 Jul 2010 18:41:02 +0000 (14:41 -0400)]
Suppress a spurious EPERM warning in epoll.c

It's okay for us to get an EPERM when doing an EPOLL_DEL on an fd; it
just means that before we got a chance to the EPOLL_DEL, we closed the
fd and reopened a new non-socket that wound up having the same fd.

Partial fix for Bug 3019973.

14 years agoDon't race when calling event_active/event_add on a running signal event
Nick Mathewson [Mon, 5 Jul 2010 18:39:39 +0000 (14:39 -0400)]
Don't race when calling event_active/event_add on a running signal event

There was previously no lock protecting the signal event's
ev_ncalls/ev_pncalls fields, which were accessed by all of
event_signal_closure, event_add_internal, event_del_internal, and
event_active_nolock.  This patch fixes this race by using the
current_event_lock in the same way it's used to prevent
event_del_internal from touching an event that's currently running.

14 years agoTidy up the code in evthread_make_base_notifiable a little
Nick Mathewson [Mon, 5 Jul 2010 17:24:45 +0000 (13:24 -0400)]
Tidy up the code in evthread_make_base_notifiable a little

Previously, we had a few conditional statements with the "if (...)"
inside an #ifdef and the body outside.  That kind of thing is hard to
read.

14 years agoDrain th_notify_fd[0] more bytes at a time.
Nick Mathewson [Mon, 5 Jul 2010 17:24:12 +0000 (13:24 -0400)]
Drain th_notify_fd[0] more bytes at a time.

14 years agoFix a deadlock related to event-base notification. Diagnosed by Zhou Li, Avi Bab...
Nick Mathewson [Mon, 5 Jul 2010 17:17:47 +0000 (13:17 -0400)]
Fix a deadlock related to event-base notification.  Diagnosed by Zhou Li, Avi Bab, and Scott Lamb.

The problem was that the thread doing the notification could block on
write in evthread_notify_base_default while holding the th_base_lock.
The main thread would never drain th_notify_fd[0], since it would need
th_base_lock to actually trigger events.

14 years agoMake sample/hello_world work on windows
Nick Mathewson [Mon, 5 Jul 2010 16:28:22 +0000 (12:28 -0400)]
Make sample/hello_world work on windows

We forgot to include the WSAStartup call in main().

Patch from an anonymous user on Sourceforge.

Fixes bug 3025354.

14 years agonever let bufferevent_rlim functions return negative
Nick Mathewson [Mon, 5 Jul 2010 16:26:21 +0000 (12:26 -0400)]
never let bufferevent_rlim functions return negative

14 years agoReally only add libevent_core.la to LIBADD on mingw
Sebastian Hahn [Tue, 22 Jun 2010 23:15:15 +0000 (01:15 +0200)]
Really only add libevent_core.la to LIBADD on mingw

Commit fdc629736e1 tried to do this, but added it for mingw and
for everything else. Fixes a segfault in bufferevent unittests.

14 years agoAdd bufferevent_lock()/bufferevent_unlock()
Nick Mathewson [Mon, 21 Jun 2010 16:26:21 +0000 (12:26 -0400)]
Add bufferevent_lock()/bufferevent_unlock()

Although bufferevent operations are threadsafe, sometimes you need
to make sure that a few operations on a single bufferevent will all
be executed with nothing intervening.  That's what these functions
are for.

14 years agoFix sentence fragment in docs for event_get_struct_event_size()
Nick Mathewson [Mon, 21 Jun 2010 16:24:49 +0000 (12:24 -0400)]
Fix sentence fragment in docs for event_get_struct_event_size()

14 years agoUnit test for event_get_struct_event_size()
Nick Mathewson [Mon, 21 Jun 2010 16:23:32 +0000 (12:23 -0400)]
Unit test for event_get_struct_event_size()

14 years agoAdd a comment to describe our plan for library versioning
Nick Mathewson [Sat, 19 Jun 2010 22:23:16 +0000 (18:23 -0400)]
Add a comment to describe our plan for library versioning

14 years agoSet library version for libevent_pthreads correctly
Nick Mathewson [Sat, 19 Jun 2010 22:22:48 +0000 (18:22 -0400)]
Set library version for libevent_pthreads correctly

14 years agoDocument a change in the semantics of event_get_struct_event_size()
Nick Mathewson [Sat, 19 Jun 2010 22:21:40 +0000 (18:21 -0400)]
Document a change in the semantics of event_get_struct_event_size()

14 years agoHave autogen.sh pass --force-missing to automake
Nick Mathewson [Thu, 17 Jun 2010 14:33:06 +0000 (10:33 -0400)]
Have autogen.sh pass --force-missing to automake

Previously, our autogen.sh script wouldn't tell automake to update
older versions of its copied-in scripts, which would cause problems if
they got sufficiently out-of-date.

14 years agoRemove some automake-generated files from version control.
Nick Mathewson [Thu, 17 Jun 2010 14:31:35 +0000 (10:31 -0400)]
Remove some automake-generated files from version control.

14 years agoFix a pedantic gcc 4.4 warning in event2/event.h
Nick Mathewson [Fri, 11 Jun 2010 15:57:13 +0000 (11:57 -0400)]
Fix a pedantic gcc 4.4 warning in event2/event.h

14 years agoFix possible nullptr dereference in evhttp_send_reply_end()
Felix Nawothnig [Sun, 30 May 2010 01:17:48 +0000 (03:17 +0200)]
Fix possible nullptr dereference in evhttp_send_reply_end()

(The existing implementation had sanity-checking code for the case where
 its argument was NULL, but it erroneously dereferenced it before actually
 doing the sanity-check. --nickm)

14 years agoAdd a function to retrieve the other side of a bufferevent pair
Nick Mathewson [Mon, 7 Jun 2010 16:06:43 +0000 (12:06 -0400)]
Add a function to retrieve the other side of a bufferevent pair

14 years agoAdd test for behavior on remote socket close
Nick Mathewson [Thu, 3 Jun 2010 15:25:54 +0000 (11:25 -0400)]
Add test for behavior on remote socket close

On all the backends on this little mac laptop, that behavior is to
report a remote socket close as both EV_READ and EV_WRITE.
Historically, we had problem for some of these behaviors on some
backends, so let's make sure that such behaviors don't come back.

14 years agoFix logic in correcting high values from FIONREAD
Nick Mathewson [Fri, 28 May 2010 19:05:32 +0000 (15:05 -0400)]
Fix logic in correcting high values from FIONREAD

The old logic made sense back when buffer.c was an enormous linear
buffer, but it doesn't make any sense for the chain-based
implementation.

This patch also refactors the ioctl{socket}? call into its own function.

14 years agoClose the file in evutil_read_file whether there's an error or not.
Pierre Phaneuf [Fri, 28 May 2010 02:37:09 +0000 (22:37 -0400)]
Close the file in evutil_read_file whether there's an error or not.

evutil_read_file would close the file if there was an error, but not if things went normally.

14 years agoAdd the libtool-generated /m4/* stuff to .gitignore
Nick Mathewson [Thu, 27 May 2010 05:32:11 +0000 (01:32 -0400)]
Add the libtool-generated /m4/* stuff to .gitignore

14 years agoLet evhttp_send_error infer the right error reasons
Nick Mathewson [Wed, 26 May 2010 16:58:02 +0000 (12:58 -0400)]
Let evhttp_send_error infer the right error reasons

14 years agoFix the default HTTP error template
Felix Nawothnig [Wed, 26 May 2010 16:50:59 +0000 (12:50 -0400)]
Fix the default HTTP error template

The current template...

<HTML><HEAD><TITLE>%s</TITLE>
</HEAD><BODY>
<H1>Method Not Implemented</H1>
Invalid method in request<P>
</BODY></HTML>

is highly confusing. The given title is easily overlooked and the
hard-coded content is just plain wrong in most cases (I really read
this as "the server did not understand the requested HTTP method)

This patch changes the template to include the error reason in the
body as well as in the header, and to infer the proper reason from
the status code whenever the reason argument is NULL.

This patch also removes a redundant evhttp_add_header from
evhttp_send_error; evhttp_send_page already adds a "Connection:
close" header.

14 years agoHave the unit tests report errors from test.sh
Nick Mathewson [Wed, 26 May 2010 17:32:32 +0000 (13:32 -0400)]
Have the unit tests report errors from test.sh

The default behavior of test.sh was to suppress all output from
test/regress, and say nothing but OKAY or FAILED.  This wasn't so good
for getting bugs reported, since lots of people didn't know to set
TEST_OUTPUT_FILE, or re-run ./test/regress on its own.

Now, when you don't specify an output file for test.sh, it runs
regress with the --quiet option.  This option makes the unit tests
only print output on failure, which is what we probably wanted.

14 years agoMake test.sh exit with nonzero status if tests fail
Nick Mathewson [Wed, 26 May 2010 17:31:41 +0000 (13:31 -0400)]
Make test.sh exit with nonzero status if tests fail

This behavior makes "make verify" actually fail when the tests fail,
which is what it's supposed to do.

14 years agoRemove all non-error prints from test/regress.c
Nick Mathewson [Wed, 26 May 2010 17:19:08 +0000 (13:19 -0400)]
Remove all non-error prints from test/regress.c

Now, running ./test/regress --quiet will indeed only inform you
about errors.  Previously, it would also spew extra output.

14 years agoRemove the now-obsolete setup_test() and cleanup_test() functions
Nick Mathewson [Wed, 26 May 2010 17:18:30 +0000 (13:18 -0400)]
Remove the now-obsolete setup_test() and cleanup_test() functions

14 years agoUse generic win32 interfaces, not ASCII-only ones, where possible.
Nick Mathewson [Mon, 24 May 2010 19:24:03 +0000 (15:24 -0400)]
Use generic win32 interfaces, not ASCII-only ones, where possible.

14 years agoMerge branch 'evdns_no_empty_handles'
Nick Mathewson [Wed, 19 May 2010 14:49:49 +0000 (10:49 -0400)]
Merge branch 'evdns_no_empty_handles'

14 years agoRemove some dead assignments
Nick Mathewson [Tue, 18 May 2010 21:28:51 +0000 (17:28 -0400)]
Remove some dead assignments

14 years agoIf no evdns request can be launched, return NULL, not a handle
Nick Mathewson [Tue, 18 May 2010 21:27:06 +0000 (17:27 -0400)]
If no evdns request can be launched, return NULL, not a handle

Some of our evdns code was willing to return an evdns_request with
handle->current_req set to NULL.  Really, those cases should just
return NULL.

14 years agoUse -Wlogical-op on gcc 4.5 or higher
Nick Mathewson [Tue, 18 May 2010 18:05:01 +0000 (14:05 -0400)]
Use -Wlogical-op on gcc 4.5 or higher

It exposed one bug for us (see 8c3452bcb294e07888), and might
prevent more.

14 years agoCorrectly recognize .255 addresses as link-local when looking for interfaces
Nick Mathewson [Tue, 18 May 2010 17:55:32 +0000 (13:55 -0400)]
Correctly recognize .255 addresses as link-local when looking for interfaces

14 years agoAvoid close of uninitialized socket in evbuffer unit test
Nick Mathewson [Mon, 17 May 2010 15:58:07 +0000 (11:58 -0400)]
Avoid close of uninitialized socket in evbuffer unit test

Attempts to fix a crash bug found by Brodie Thiesfield.

14 years agoReplace (safe) use of strcpy with memcpy to appease OpenBSD
Nick Mathewson [Fri, 14 May 2010 18:36:49 +0000 (14:36 -0400)]
Replace (safe) use of strcpy with memcpy to appease OpenBSD

If Libevent uses strcpy, even safely, it seems OpenBSD's linker will
complain every time a library links Libevent.  It's easier just not to
use the old thing, even when it's safe to do so.

14 years agoAdd some missing includes to fix Linux build again
Nick Mathewson [Fri, 14 May 2010 18:30:09 +0000 (14:30 -0400)]
Add some missing includes to fix Linux build again

14 years agoMake test-ratelim clean up after itself better.
Nick Mathewson [Thu, 13 May 2010 19:38:39 +0000 (15:38 -0400)]
Make test-ratelim clean up after itself better.

14 years agoAvoid event_del on uninitialized event in event_base_free
Nick Mathewson [Thu, 13 May 2010 18:59:33 +0000 (14:59 -0400)]
Avoid event_del on uninitialized event in event_base_free

This was mostly harmless, since the event was cleared with calloc, but
still it's not a correct thing to do.

14 years agoAdd options to test-ratelim.c to check its results
Nick Mathewson [Thu, 13 May 2010 16:01:30 +0000 (12:01 -0400)]
Add options to test-ratelim.c to check its results

The new options let you specify a maximum deviation of bandwidth used
from expected bandwidth used, and make test-ratelim.c exit with a
nonzero status when those deviations are violated.

This patch also adds a test-ratelim.sh script to run test-ratelim with
a few sensible options for testing.

14 years agoDo not check that event_base is set in EVBASE_ACQUIRE_LOCK
Nick Mathewson [Thu, 13 May 2010 15:24:07 +0000 (11:24 -0400)]
Do not check that event_base is set in EVBASE_ACQUIRE_LOCK

In every place that we call EVBASE_ACQUIRE_LOCK, the base is either
set, or must be set, so the test is redundant.

14 years agoRemove the now-unusable EVTHREAD_LOCK/UNLOCK constants
Nick Mathewson [Thu, 13 May 2010 15:23:12 +0000 (11:23 -0400)]
Remove the now-unusable EVTHREAD_LOCK/UNLOCK constants

14 years agoMark the event_err() functions as __attribute__((noreturn))
Nick Mathewson [Thu, 13 May 2010 14:57:30 +0000 (10:57 -0400)]
Mark the event_err() functions as __attribute__((noreturn))

This attribute tells gcc (and anything else that understands gcc
attributes) that the functions will never return control, and helps
the optimizer a little.  With luck, it will also tell
less-than-full-program dataflow analysis tools that they don't need to
worry about any code path that involves calling one of these functions
and then returning.

This patch also forces event_exit() to always exit, no matter what the
user-supplied fatal_callback does.  This means that the old unit tests
for the event_err* functions don't work any more, since they assume it
is safe to call event_err* if you've given it a bogus fatal_callback
that doesn't exit.  Instead, we have to make the unit tests fork
before calling event_err(), and have the main unit test process wait
for the event_err() test to exit with a sane exit code.  On unix,
that's trivial.  On windows, let's not bother and just assume that
event_err* works.

14 years agoTest the unlocked-deferred callback case of bufferevents
Nick Mathewson [Wed, 12 May 2010 19:38:28 +0000 (15:38 -0400)]
Test the unlocked-deferred callback case of bufferevents

14 years agoRemove the obsolete evthread interfaces
Nick Mathewson [Tue, 11 May 2010 15:44:07 +0000 (11:44 -0400)]
Remove the obsolete evthread interfaces

These were added in 2.0.1, and deprecated in 2.0.4 and 2.0.5; we've
promised that they would be removed, and warned whenever they were
invoked.  Users should call evthread_set_lock_callbacks instead...  or
ideally just call evthread_use_windows_threads or
evthread_use_pthreads.

14 years agoBump version to 2.0.5-beta-dev
Nick Mathewson [Mon, 10 May 2010 18:51:32 +0000 (14:51 -0400)]
Bump version to 2.0.5-beta-dev

14 years agoIncrement version numbers for 2.0.5-beta release-2.0.5-beta
Nick Mathewson [Sun, 9 May 2010 04:22:08 +0000 (00:22 -0400)]
Increment version numbers for 2.0.5-beta

14 years agoAdd a changelog for 2.0.5-beta
Nick Mathewson [Sun, 9 May 2010 04:16:35 +0000 (00:16 -0400)]
Add a changelog for 2.0.5-beta

14 years agoFix some autoconf issues on OpenBSD
Nick Mathewson [Sun, 9 May 2010 03:29:29 +0000 (23:29 -0400)]
Fix some autoconf issues on OpenBSD

Issue 1: autoconf gets accept when a header works properly with cpp
but not with cc.  This was true of the sys/sysctl.h header on
openbsd.  The fix: include sys/param.h (if present) when testing for
sys/sysctl.h

Issue 2: Somehow, autoconf's macro generation code is messed up on
some versions of openbsd (including mine, and other people's too) so
that instead of SIZEOF_VOID_P, it makes SIZEOF_VOID__.
evutil/util.h now works around that.

14 years agoDefine _REENTRANT as needed on Solaris, elsewhere
Nick Mathewson [Sun, 9 May 2010 02:21:52 +0000 (22:21 -0400)]
Define _REENTRANT as needed on Solaris, elsewhere

It turns out that _REENTRANT isn't only needed to make certain
functions visible; we also need it to make pthreads work properly
some places (like Solaris, where forgetting _REENTRANT basically
means that all threads are sharing the same errno).  Fortunately,
our ACX_PTHREAD() configure macro already gives us a PTHREAD_CFLAG
variable, so all we have to do is use it.

14 years agoFix test.sh on freebsd
Nick Mathewson [Sat, 8 May 2010 23:56:25 +0000 (19:56 -0400)]
Fix test.sh on freebsd

It turns out that in all conformant shells, "unset FOO" removes FOO
both from the shell's variables and from the exported environment.
(I've tested this on msys, opensolaris, linux, osx, and freebsd.)

And in nearly every shell I can find, "unset FOO; export FOO" does
the same as unset FOO... except in my FreeBSD VM, where the "export
FOO" sets the exported value of FOO equal to "".  This broke test.sh
for us.

The fix is simple: remove the needless exports!

14 years agoMake test.sh support mingw/msys on win32
Nick Mathewson [Sat, 8 May 2010 22:00:26 +0000 (18:00 -0400)]
Make test.sh support mingw/msys on win32

This required:
   - Adding another WIN32 section in test.sh
   - not running "touch /dev/null"
   - calling WSAStartup in all the test binaries
   - Fixing a dumb windows-only bug in test-time.c

14 years agoFix whitespace in evutil.c
Nick Mathewson [Sat, 8 May 2010 23:36:05 +0000 (19:36 -0400)]
Fix whitespace in evutil.c

14 years agoFix another nasty solaris getaddrinfo() behavior
Nick Mathewson [Sat, 8 May 2010 23:16:47 +0000 (19:16 -0400)]
Fix another nasty solaris getaddrinfo() behavior

Everybody else thinks that when you getaddrinfo() on an ip address
and don't specify the protocol and the socktype, it should give you
multiple answers , one for each protocol/socktype implementation.

OpenSolaris takes a funny view of RFC3493, and leaves the results set
to 0.

This patch post-processes the getaddrinfo() results for consistency.

14 years agoFix getaddrinfo with protocol unset on Solaris 9. Found by Dagobert Michelsen
Nick Mathewson [Wed, 21 Apr 2010 15:57:55 +0000 (11:57 -0400)]
Fix getaddrinfo with protocol unset on Solaris 9. Found by Dagobert Michelsen

Apparently when you call Solaris 9's getaddrinfo(), it likes to leave
ai_protocol unset in the result. This is no way to behave, if I'm
reading RFC3493 right.

This patch makes us check for a getaddrinfo() that's broken in this way,
and work around it by trying to infer socktype and protocol from one
another.

Partial bugfix for 2987542

14 years agoNumerous opensolaris compilation fixes
Nick Mathewson [Sat, 8 May 2010 22:09:27 +0000 (18:09 -0400)]
Numerous opensolaris compilation fixes

For future note, opensolaris doesn't have sys/sysctl.h, doesn't like
comparing iov_buf to a chain_space_ptr without a cast, and is (predictably)
unforgiving of dumb syntax errors.

Also, we had accidentally broken the devpoll backend test in configure.in

14 years agoMake test for bufferevent_connect_hostname system-neutral
Nick Mathewson [Sat, 8 May 2010 23:11:50 +0000 (19:11 -0400)]
Make test for bufferevent_connect_hostname system-neutral

Previously, the be5_outcome field for the dns error would be set to
something dependent on our system resolver.  It turns out that you
can't rely on nameservers to really give you an NEXIST answer for
xyz.example.com nowadays: too many of them are annoyingly broken and
like to redirect you to their locked-in portals.  This patch changes
the bufferevent_connect_hostname test so that it makes sure that the
dns_error of be5_outcome is "whatever you would get from resolving
the target hostname"

14 years agoMake unit test for add_file able to tell "error" from "done"
Nick Mathewson [Sat, 8 May 2010 23:09:09 +0000 (19:09 -0400)]
Make unit test for add_file able to tell "error" from "done"

Importantly, we don't actually want to call evbuffer_write() when
the buffer is empty.  This makes it an error to ever get a -1 return
value from evbuffer_add_file(), which makes it safe for us to test
the return value.

14 years agoFix bench_http build on win32.
Nick Mathewson [Sat, 8 May 2010 21:15:52 +0000 (17:15 -0400)]
Fix bench_http build on win32.

14 years agoadd more (currently skipped) add_file tests on win32
Nick Mathewson [Sat, 8 May 2010 20:47:07 +0000 (16:47 -0400)]
add more (currently skipped) add_file tests on win32

14 years agoFix unused-variable warning when building with threads disabled
Nick Mathewson [Sat, 8 May 2010 20:41:01 +0000 (16:41 -0400)]
Fix unused-variable warning when building with threads disabled

14 years agoMake evbuffer_add_file() work on windows
Nick Mathewson [Sat, 8 May 2010 20:34:18 +0000 (16:34 -0400)]
Make evbuffer_add_file() work on windows

Right now only the add_file() mode is supported, when it would be
nicer to have mmap support.  Perhaps for Libevent 2.1.x.

14 years agoImplement regress_make_tempfile on win32 to test evbuffer_add_file
Nick Mathewson [Sat, 8 May 2010 18:49:59 +0000 (14:49 -0400)]
Implement regress_make_tempfile on win32 to test evbuffer_add_file

(Conclusion: evbuffer_add_file is broken on win32, since it
uses recv on a file.)

14 years agoFix some crazy macro mistakes in arc4random.c
Nick Mathewson [Sat, 8 May 2010 19:31:54 +0000 (15:31 -0400)]
Fix some crazy macro mistakes in arc4random.c

14 years agoDetect broken unsetenv at unit-test runtime
Nick Mathewson [Wed, 21 Apr 2010 16:25:29 +0000 (12:25 -0400)]
Detect broken unsetenv at unit-test runtime

If we have an unsetenv function that doesn't work, we can't run the
main/base_environ unit test, so we should skip it.

14 years agoOnly add libevent_core.la to LIBADD on mingw
Nick Mathewson [Thu, 6 May 2010 18:37:23 +0000 (14:37 -0400)]
Only add libevent_core.la to LIBADD on mingw

Chris Davis reports that this is also necessary to fix building with
shared libraries on OSX for him.  Should fix bug 2997775.

There is probably a better fix for the issues solved by commit
3cbca8661f, but for now, we're trying to get a beta out the door.

14 years agoOnly specify -no-undefined on mingw
Nick Mathewson [Thu, 6 May 2010 18:37:23 +0000 (14:37 -0400)]
Only specify -no-undefined on mingw

It turns out that commit 3cbca8661f broke building with shared
libraries on OSX.  Since -no-undefined is only necessary on platforms
like win32, only use it there.

There may be a better fix for this.  Should fix bug 2997775.

14 years agoMerge commit 'chrisd/connect-hostname-report-err'
Nick Mathewson [Thu, 6 May 2010 18:16:50 +0000 (14:16 -0400)]
Merge commit 'chrisd/connect-hostname-report-err'

14 years agoStop distributing and installing manpages: they were too inaccurate
Nick Mathewson [Thu, 6 May 2010 17:26:05 +0000 (13:26 -0400)]
Stop distributing and installing manpages: they were too inaccurate

It would be great to have the manpages come back some time, perhaps
from a refactoring of my asciidoc book, but for now the existing
manpages were the single worst, most incomplete, and most misleading
libevent documentation we had.  (Less misleading: the doxygen output,
the header files, and my reference book.)

14 years agoRename current_base symbol to event_global_current_base_
Nick Mathewson [Tue, 4 May 2010 17:27:36 +0000 (13:27 -0400)]
Rename current_base symbol to event_global_current_base_

The "current_base" symbol was never actually declared in an exported
header; it's hideously deprecated, and it was the one remaining
exported symbol (fwict) that was prefixed with neither ev nor
bufferevent nor _ev nor _bufferevent.

codesearch.google.com turns up no actual attempts to use our
current_base from outside libevent.

14 years agoFix symbol conflict between mm_*() macros and libmm
Nick Mathewson [Tue, 4 May 2010 16:57:40 +0000 (12:57 -0400)]
Fix symbol conflict between mm_*() macros and libmm

Our mm_malloc, mm_calloc, etc functions were all exported, since C
hasn't got a nice portable way to say "we want to use this function
inside our library but not export it to others".  But they apparently
conflict with anything else that calls its symbols mm_*, as libmm does.

This patch renames the mm_*() functions to event_mm_*_(, and defines
maros in mm_internal so that all the code we have that uses mm_*()
will still work.  New code should also prefer the mm_*() macro names.

Reported by Gernot Tenchio.  Fixes sf bug 2996541