]> granicus.if.org Git - libevent/log
libevent
14 years agoFix uninitialized port var in http_delete_test. Last one, I hope.
Nick Mathewson [Sat, 4 Sep 2010 02:00:25 +0000 (22:00 -0400)]
Fix uninitialized port var in http_delete_test.  Last one, I hope.

14 years agoFix uninitialized variables in http_bad_request_test. (oops)
Nick Mathewson [Sat, 4 Sep 2010 01:03:25 +0000 (21:03 -0400)]
Fix uninitialized variables in http_bad_request_test. (oops)

14 years agoAllow more than one copy of regression tests to run at once
Nick Mathewson [Fri, 3 Sep 2010 22:48:31 +0000 (18:48 -0400)]
Allow more than one copy of regression tests to run at once

Mostly this was a matter of just removing all the hardwired ports in
the test code.  The http/connection_retry test is still a little
screwy, though.

14 years agoExpose a function to add a nameserver by sockaddr
Nick Mathewson [Fri, 3 Sep 2010 20:42:16 +0000 (16:42 -0400)]
Expose a function to add a nameserver by sockaddr

14 years agoExpose a function to getsockname() on a listener's fd.
Nick Mathewson [Fri, 3 Sep 2010 20:41:16 +0000 (16:41 -0400)]
Expose a function to getsockname() on a listener's fd.

14 years agoPrefer autoreconf -ivf to manual autogen.sh
Nick Mathewson [Fri, 3 Sep 2010 19:12:35 +0000 (15:12 -0400)]
Prefer autoreconf -ivf to manual autogen.sh

Suggested by Ralph Castain

14 years agoFix a bug in our win32 condition implementation
Nick Mathewson [Mon, 30 Aug 2010 15:35:06 +0000 (11:35 -0400)]
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.

14 years agoFix an issue with forking and signal socketpairs in select/poll backends
Nick Mathewson [Thu, 26 Aug 2010 19:09:58 +0000 (15:09 -0400)]
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

14 years agoRename regress_pthread.c to regress_thread.c
Nick Mathewson [Tue, 17 Aug 2010 18:44:12 +0000 (14:44 -0400)]
Rename regress_pthread.c to regress_thread.c

14 years agoDetect events with no ev_base; warn instead of crashing
Nick Mathewson [Mon, 23 Aug 2010 16:01:45 +0000 (12:01 -0400)]
Detect events with no ev_base; warn instead of crashing

14 years agoHonor NDEBUG; build without warnings with NDEBUG; make NDEBUG always-off in unit...
Nick Mathewson [Mon, 23 Aug 2010 15:48:46 +0000 (11:48 -0400)]
Honor NDEBUG; build without warnings with NDEBUG; make NDEBUG always-off in unit test code

14 years agoAvoid deadlock when activating signals.
Nick Mathewson [Thu, 19 Aug 2010 18:00:06 +0000 (14:00 -0400)]
Avoid deadlock when activating signals.

Fixes bug 3048812.

Based on patch by Nicholas Marriott.

14 years agoFix kquue correctness test on x84_64
Nick Mathewson [Thu, 19 Aug 2010 13:38:44 +0000 (09:38 -0400)]
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

14 years agoFix logic error in win32 TRY_LOCK that caused problems with rate-limiting
Nick Mathewson [Wed, 18 Aug 2010 16:02:25 +0000 (12:02 -0400)]
Fix logic error in win32 TRY_LOCK that caused problems with rate-limiting

14 years agoSet close-on-exec bit for filedescriptors created by dns subsystem.
Nick Mathewson [Wed, 18 Aug 2010 14:49:12 +0000 (10:49 -0400)]
Set close-on-exec bit for filedescriptors created by dns subsystem.

Based on patch for 1.4 by Ralf Schmitt.

14 years agoCorrectly detect failure to delete bufferevent read-timeout event
Nick Mathewson [Tue, 17 Aug 2010 17:26:03 +0000 (13:26 -0400)]
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

14 years agoAdd a unit test for conditions
Nick Mathewson [Tue, 17 Aug 2010 02:55:45 +0000 (22:55 -0400)]
Add a unit test for conditions

14 years agoMake the regress_pthread.c tests work on windows with current test APIs
Nick Mathewson [Mon, 16 Aug 2010 16:38:22 +0000 (12:38 -0400)]
Make the regress_pthread.c tests work on windows with current test APIs

14 years agoUse conditions instead of current_event_lock to fix a deadlock.
Nick Mathewson [Tue, 17 Aug 2010 17:18:18 +0000 (13:18 -0400)]
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.

14 years agoAdd a condition variable backend, with implementations for pthreads and win32
Nick Mathewson [Tue, 17 Aug 2010 17:15:34 +0000 (13:15 -0400)]
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*.

14 years agoMake definition of WIN32_LEAN_AND_MEAN in event.h conditional.
Gilad Benjamini [Fri, 13 Aug 2010 21:19:18 +0000 (17:19 -0400)]
Make definition of WIN32_LEAN_AND_MEAN in event.h conditional.

(Inclusion order might trigger a warning for redefinition on Windows.)

14 years agoClean up syntax on TAILQ_ENTRY() usage
Gilad Benjamini [Fri, 13 Aug 2010 21:08:59 +0000 (17:08 -0400)]
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)

14 years agoMake include/event2/event-config.h not included in source dist
Nick Mathewson [Fri, 13 Aug 2010 15:41:37 +0000 (11:41 -0400)]
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_ .

14 years agoChange include order in Makefile.nmake
Nick Mathewson [Fri, 13 Aug 2010 15:34:39 +0000 (11:34 -0400)]
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.

14 years agoUpdate the whatsnew-2.0.txt document
Nick Mathewson [Wed, 11 Aug 2010 01:05:52 +0000 (21:05 -0400)]
Update the whatsnew-2.0.txt document

14 years agoDocument that DNS_NO_SEARCH is an obsolete alias for DNS_QUERY_NO_SEARCH
Nick Mathewson [Tue, 10 Aug 2010 19:03:14 +0000 (15:03 -0400)]
Document that DNS_NO_SEARCH is an obsolete alias for DNS_QUERY_NO_SEARCH

14 years agoCompletely remove the (mostly-removed) obsolete thread functions.
Nick Mathewson [Tue, 10 Aug 2010 19:02:50 +0000 (15:02 -0400)]
Completely remove the (mostly-removed) obsolete thread functions.

14 years agoMerge branch 'more_pkgconfig'
Nick Mathewson [Tue, 10 Aug 2010 15:46:00 +0000 (11:46 -0400)]
Merge branch 'more_pkgconfig'

14 years agoAdd pkgconfig files for libevent_{openssl,pthreads}
Nick Mathewson [Tue, 10 Aug 2010 15:11:25 +0000 (11:11 -0400)]
Add pkgconfig files for libevent_{openssl,pthreads}

14 years agoFix a nasty dangling-event bug when using rate-limiting groups
Nick Mathewson [Mon, 9 Aug 2010 16:08:40 +0000 (12:08 -0400)]
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.

14 years agoIncrement vesion to 2.0.6-rc-dev
Nick Mathewson [Sat, 7 Aug 2010 03:22:01 +0000 (23:22 -0400)]
Increment vesion to 2.0.6-rc-dev

14 years agoIncrement versions to 2.0.6-rc release-2.0.6-rc
Nick Mathewson [Sat, 7 Aug 2010 01:19:44 +0000 (21:19 -0400)]
Increment versions to 2.0.6-rc

14 years agoChanglog and new acknowledgements for 2.0.6-rc
Nick Mathewson [Sat, 7 Aug 2010 01:11:01 +0000 (21:11 -0400)]
Changlog and new acknowledgements for 2.0.6-rc

14 years agoMove event-config.h to include/event2
Nick Mathewson [Wed, 7 Jul 2010 20:45:03 +0000 (16:45 -0400)]
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.

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