1308 Commits

Author SHA1 Message Date
Nick Mathewson
165d30e31a Fix compilation of rate-limiting code on win32. 2009-12-30 14:29:56 -05:00
Nick Mathewson
885b42734c Fix test-ratelim compilation on Linux.
I'd forgotten to include time.h, and to link against libm.
2009-12-30 13:50:52 -05:00
Nick Mathewson
82743794d3 Do not make bufferevent_setfd implicitly disable EV_READ and EV_WRITE.
This obviates the need for BEV_SUSPEND_CONNECTING, and good riddance.
2009-12-28 16:59:07 -05:00
Nick Mathewson
f0c0124e60 Testing code for bufferevent rate-limiting.
This is not part of the regression tests, since running it necessarily
takes a while.  There is a new test-ratelim test; run it with '-h'
for an argument to see its options.
2009-12-28 16:58:22 -05:00
Nick Mathewson
737c9cd87b Rate-limiting for bufferevents; group and individual limits are supported.
The fairness algorithms are not the best, not every bufferevent type
is supported, and some of the locking tricks here are simply absurd.
Still, this code should be a good first step.
2009-12-28 16:11:18 -05:00
Nick Mathewson
47854a802a Expose our cached gettimeofday value with a new interface
I've got a two use case that wants this for a fairly sensible purpose:
one external and on internal.
2009-12-28 16:11:18 -05:00
Jardel Weyrich
5a43df82b8 Improve readability of evutil_unparse_protoname() 2009-12-28 16:03:47 -05:00
Jardel Weyrich
0d64051f5b Fix a bogus free in evutil_new_addrinfo() 2009-12-28 16:01:59 -05:00
Jardel Weyrich
24fb502f70 Fix an fd leak in evconnlistener_new_bind(). 2009-12-28 16:01:12 -05:00
Jardel Weyrich
4c8b7cdc64 Make evutil_make_socket_nonblocking() leave any other flags alone.
Fixes bug 2922121
2009-12-28 16:00:05 -05:00
Dagobert Michelsen
fee2c77919 Fix compilation of devpoll.c by adding missing thread includes.
(Bug 2922156)
2009-12-28 15:53:01 -05:00
Nick Mathewson
a47d88d7c2 Replace some cases of uint32_t with ev_uint32_t.
Spotted by Roman Puls.
2009-12-23 07:53:19 -05:00
Nick Mathewson
4a5b53432b Do not ignore bufferevent_enable(EV_READ) before bufferevent_connect().
Previously, we weren't remembering that we wanted to re-add the read
event once the connect was finished.  Now we are.
2009-12-23 07:48:43 -05:00
Nick Mathewson
390e056152 Fix up behavior of never-defered callbacks a little 2009-12-22 15:52:12 -05:00
Nick Mathewson
5846bf6cdd Simplify the read high-watermark checking. 2009-12-22 15:52:12 -05:00
Nick Mathewson
c69d5a5d3c Remove the contents of WIN32-Prj as unmaintained.
Makefile.nmake is now the preferred way	to build with MSVC; the
project files haven't worked properly in ages.
2009-12-22 15:52:12 -05:00
Nick Mathewson
292467c02e Use evutil_socket_t, not int, when logging socket errors. 2009-12-22 00:58:52 -05:00
unknown
c51bb3c342 Fix a few locking issues on windows. 2009-12-21 16:36:40 -05:00
Nick Mathewson
5a112d3c07 Set all instances of the version number correctly.
Note that we've made two subtle mistakes: we are supposed to suffix
any non-released version with "-dev", and we're supposed to use the
last byte of the numeric version to indicate whether we have done this.

For example, when 2.0.4-alpha is released, its numeric versin will be
0x 02 00 04 00.  As soon as we tag it, we will change the version in
the git repository to 2.0.4-alpha-dev, whose numeric version will be
0x 02 00 04 01 or something.
2009-12-18 23:37:50 -05:00
Nick Mathewson
67995270ff Drop install-sh from our git repo: a mismatched version could break "make dist" 2009-12-18 17:04:37 -05:00
Joachim Bauch
a773df54ce Fix a segfault when freeing SSL bufferevents in an unusual order
Have container bufferevents hold a reference to their underlying bufferevents.

(Commit message and minor revisions by nickm.)
2009-12-18 16:26:40 -05:00
Joachim Bauch
a6adeca72c Fix a segfault when writing a very fragmented evbuffer onto an SSL
Fixes bug 2916328.
2009-12-17 12:38:46 -05:00
Evan Jones
f6430ac1e3 Update sample/signal-test.c to use newer APIs and not leak. 2009-12-08 17:05:30 -05:00
Joachim Bauch
ea6b1df288 Only define _GNU_SOURCE if it is not already defined. 2009-12-08 15:38:34 -05:00
Sebastian Hahn
70cdfe49fa Fix compile on Snow Leopard with gcc warnings enabled 2009-12-06 02:59:19 +01:00
Nick Mathewson
7ae94450fd Fix a snow leopard compile warning in the unit tests.
Reported by Sebastian Hahn.
2009-12-04 16:37:47 -05:00
Nick Mathewson
0d744aa173 Refactor our 'suspend operation' logic on bufferevents.
There are lots of things we do internally in bufferevents to indicate
"the user would like this operation to happen, but we aren't going to
try until some other condition goes away."  Our logic here has gotten
entirely too complicated.

This patch tries to fix that by adding the idea of 'suspend flags' for
read and write.  To say "don't bother reading or writing until
condition X no longer holds," bufferevent_suspend_read/write(bev,
BEV_SUSPEND_X).  When X no longer holds, call
bufferevent_unsuspend_read/write(bev, BEV_SUSPEND_X).

Right now, only the read-watermark logic uses this.
2009-12-04 14:15:17 -05:00
Nick Mathewson
438f9ed26c Add the abilitity to mark some buffer callbacks as never-deferred. 2009-12-04 14:15:17 -05:00
Nick Mathewson
689fc091a5 New EVTHREAD_TRY_LOCK function to try to grab a lock. 2009-12-04 14:15:17 -05:00
Nick Mathewson
2b7abf038f Merge commit 'niels/dnscrash' 2009-12-04 13:49:27 -05:00
Yasuoka Masahiko
6c7c5799a4 Fix a crash when reading badly formatted resolve.conf; from Yasuoka Masahiko 2009-12-04 10:44:46 -08:00
unknown
b62d979b68 Update nmake makefile to build evthread.c 2009-12-02 01:24:37 -05:00
unknown
31687b4d8a Fix regress_iocp.c usage of old lock allocation macros. 2009-12-02 01:22:07 -05:00
Roman Puls
bd6f1babf7 Fix up evthread compilation on windows 2009-12-02 01:15:15 -05:00
William Ahern
56771a3eed Valgrind fix: Clear struct kevent before checking for OSX bug.
William's original commit message:

   Valgrind complains on startup because kq_init passes to kevent only
   a partially initialized structure. The code doesn't expect kevent
   to look at .fflags, .udata, or .data, I suppose, because it merely
   tickles the kernel looking for an error response. But perhaps
   that's unwarranted chuminess (notwithstanding that it's checking
   for an OS X bug), and needless noise nonetheless.
2009-11-29 10:20:46 -05:00
Nick Mathewson
0cd3bb9f3a Improved optional lock debugging.
There were a couple of places in the code where we manually kept lock
counts to make sure we never accessed resources without holding a
lock, and that we never released a lock we didn't have.  The
lock-debugging code already puts counts on _every_ lock when lock
debugging is enabled, so there is no need to keep these counts around
otherwise.  This patch rewrites the ASSERT_FOO_LOCKED macros to all
use a common EVLOCK_ASSERT_LOCKED().

We also teach the lock debugging code to keep track of who exactly
holds each lock, so that EVLOCK_ASSERT_LOCKED() means "locked by this
thread."
2009-11-27 17:36:51 -05:00
Zhuang Yuyao
2df1f82bfa Fix an evdns lock violation.
Original message:

   evdns contains a bug related to thread lock.

   enable thread lock by evthread_use_pthreads() will cause successive
   evdns_base_resolve_ipv4() (and other resolve functions i think) to
   hang on EVDNS_LOCK(base) after one or several successful call to
   evdns_base_resolve_ipv4().
2009-11-27 17:36:51 -05:00
Nick Mathewson
da1718b289 Fix a locking bug in event_base_loop()
We previously were releasing the lock when we exited the main loop
in some ways, but not in others.
2009-11-27 17:36:51 -05:00
Nick Mathewson
d84d8385cd Fix two use-after-free bugs in unit tests spoted by lock debugging 2009-11-27 17:36:51 -05:00
Nick Mathewson
76cd2b70bb Stop passing EVTHREAD_READ and EVTHREAD_WRITE to non-rw locks.
Previously, our default lock model kind of assumed that every lock was
potentially a read-write lock.  This was a poor choice, since
read-write locks are far more expensive than regular locks, and so the
lock API should only use them when we can actually take advantage of
them.  Neither our pthreads or win32 lock implementation provided rw
locks.

Now that we have a way (not currently used!) to	indicate that we
really want a read-write lock, we shouldn't actually say "lock this
for reading" or "lock this for writing" unless we mean it.
2009-11-27 17:36:51 -05:00
Nick Mathewson
347952ffe0 Revise the locking API: deprecate the old locking callbacks and add trylock.
Previously, there was no good way to request different kinds of lock
(say, read/write vs writeonly or recursive vs nonrecursive), or for a
lock function to signal failure (which would be important for a
trylock mode).

This patch revises the lock API to be a bit more useful.  The older
lock calls are still supported for now.

We also add a debugging mode to catch common errors in using the
locking APIs.
2009-11-27 17:36:24 -05:00
Nick Mathewson
e1ffbb82e3 Fix memory-leak of signal handler array with kqueue.
It turns out that kqueue_dealloc wasn't calling evsig_dealloc()
(because it doesn't use the main signal handler logic) so the sh_old
array was leaking.

This patch also introduces a fix in evsig_dealloc() where we set
the sh_old array to NULL when we free it, so that main/fork can pass.
2009-11-21 23:57:44 -05:00
Nick Mathewson
07e9e9b4b1 Parenthesize macro arguments more aggressively 2009-11-20 16:50:55 -05:00
Nick Mathewson
f32b57505e Add a warning about the use of event_initialized. 2009-11-20 16:38:01 -05:00
Nick Mathewson
91fe23fc08 Tolerate code that returns from a fatal_cb.
Also, replace more abort() calls with EVUTIL_ASSERT() or event_errx.
2009-11-20 15:46:04 -05:00
Nick Mathewson
94d00651f4 Add stub header for 2.0.4-alpha changelog. 2009-11-20 12:56:29 -05:00
Nick Mathewson
0af10d5695 Add more people who wrote patches to the acknowledgments
The names came from grepping ChangeLog for 'patch/code from/by'.
2009-11-20 12:47:21 -05:00
Nick Mathewson
0b4272681f Improve the README with more information and links.
(Also, try to test out the new commit script.)
2009-11-20 12:37:47 -05:00
Nick Mathewson
ba3407142b Add a .gitignore file.
.gitignore plays the same role in Git as the svn:ignore property does in
subversion.
2009-11-20 12:17:14 -05:00
Niels Provos
505040a2b5 call it 2.0.3-alpha
svn:r1556
2009-11-20 00:18:35 +00:00