1754 Commits

Author SHA1 Message Date
Nick Mathewson
ef18c994c3 Increment the version to 2.0.8-rc
NOTE: This is not the official release until I tag it.  If you see
    this commit, and you decide that Libevent 2.0.8-rc is now
    finalized, you might get something besides 2.0.8-rc.
release-2.0.8-rc
2010-10-14 18:36:07 -04:00
Nick Mathewson
15be0493f6 Changelog and readme for 2.0.8-rc 2010-10-14 18:35:11 -04:00
Nick Mathewson
4ebf9509f7 Fixes for MSVC compilation 2010-10-14 14:40:40 -04:00
Nick Mathewson
d3b096c011 Make the --enable-gcc-warnings option include signed comparison warnings 2010-10-14 13:54:15 -04:00
Nick Mathewson
e06f514d4e Fix signed/unsigned warnings on win32 2010-10-14 13:51:24 -04:00
Nick Mathewson
6be589ae68 Fix signed/unsigned warnings on opensolaris, where iov_len is signed 2010-10-14 13:48:40 -04:00
Nick Mathewson
e5c214a423 Fix -Wsigned-compare warnings in test/* 2010-10-14 13:16:41 -04:00
Nick Mathewson
f2763fa864 add limits.h to event_tagging.c so opensolaris will build 2010-10-14 13:16:00 -04:00
Nick Mathewson
5e4bafbb89 fix a signed/unsigned warning in kqueue.c 2010-10-14 13:15:32 -04:00
Nick Mathewson
02f6259fc3 New unit test for ssl bufferevents starting with connected SSLs. 2010-10-14 12:17:28 -04:00
Nick Mathewson
93bb7d8e19 Fix a case where an ssl bufferevent with CLOSE_ON_FREE didn't close its fd
This could happen when we got an SSL with a BIO already set on it.
2010-10-14 12:17:24 -04:00
Nick Mathewson
223ee40fde Avoid spurious reads from just-created open openssl bufferevents
When handshaking, we listen for reads or writes from the
transport. But when we're connected, we start out with writes enabled
and reads disabled, which means we should not have the transport read
for us.
2010-10-14 10:55:04 -04:00
Nick Mathewson
34331e456d The corrected bufferevent filter semantics let us fix our openssl tests 2010-10-14 10:55:04 -04:00
Nick Mathewson
ac27eb8276 Correct logic on disabling underlying bufferevents when disabling a filter
Previously, whenever writing was disabled on a bufferevent_filter (or
a filtering SSL bufferevent), we would stop writing on the underlying
bufferevent.  This would make for trouble, though, since if you
implemented common patterns like "stop writing once data X has been
flushed", your bufferevent filter would disable the underlying
bufferevent after the data was flushed to the underlying bufferevent,
but before actually having it written to the network.

Now, we have filters leave their underlying bufferevents enabled for
reading and writing for reading and writing immediately.  They are not
disabled, unless the user wants to disable them, which is now allowed.
To handle the case where we want to choke reading on the underlying
bufferevent because the filter no longer wants to read, we use
bufferevent_suspend_read().  This is analogous to the way that we use
bufferevent_suspend_write() to suspend writing on a filtering
bufferevent when the underlying bufferevent's output buffer has hit
its high watermark.
2010-10-14 10:55:04 -04:00
Nick Mathewson
34d64f8a34 Fix serious bugs in per-bufferevent rate-limiting code
Our old code was too zealous about deleting the refill events that
would actually make connections able to read or write again after
they had run out of bandwidth.  Under some circumstances, this could
cause a bufferevent to never actually refill one of its
rate-limiting buckets.

Also, the code treated setting a per-connection rate-limit on a
connection that already had a group-limit as if it were changing the
limit on a connection whose allocation had already run out.

This patch fixes both of those problems.
2010-10-12 13:54:07 -04:00
Nick Mathewson
819b171572 Handle rate-limiting for reading on OpenSSL bufferevents correctly.
We were looking at the number of bytes read on the wbio, not in the
rbio.  But these are usually different BIOs, and the reading is
supposed to happen on the rbio.
2010-10-12 12:59:46 -04:00
Nick Mathewson
7ad90f6a25 Merge branch '20_internal_prio' 2010-10-09 00:02:31 -04:00
Nick Mathewson
08ebd26730 Merge branch 'iovmax' 2010-10-07 21:06:25 -04:00
Nick Mathewson
120570356b Turn some booleans in evconnlistener_iocp into one-bit bitfields. 2010-10-07 18:11:38 -04:00
Christopher Davis
62b429afa8 Make iocp/listener/error work; don't accept again if lev is disabled. 2010-10-07 18:11:38 -04:00
Nick Mathewson
481ef92086 Fix allocation error for IOCP listeners. Probably harmless, since struct event is big 2010-10-07 18:11:37 -04:00
Nick Mathewson
127d4f2195 Add a LEV_OPT_THREADSAFE option for threadsafe evconnlisteners 2010-10-07 18:11:19 -04:00
Nick Mathewson
fdc640b02d Fix an EINVAL on evbuffer_write_iovec on OpenSolaris.
The writev() call is limited to at most IOV_MAX iovecs (or UIO_MAXIOV,
depending on whom you ask).  This isn't a problem anywhere we've
tested except on OpenSolaris, where IOV_MAX was a mere 16.

This patch makes us go from "use up to 128 iovecs when writing" to
"use up to 128 iovecs when writing, or IOV_MAX/UIO_MAXIOV, whichever
is less".  This is still wrong if you somehow find a platform that
defines IOV_MAX < UIO_MAXIOV, but I hereby claim that such a platform
is too stupid to worry about for now.

Found by Michael Herf.
2010-10-06 10:56:49 -04:00
Nick Mathewson
5b7a370636 Fix warnings on mingw with gcc 4.5 2010-10-05 14:29:48 -04:00
Nick Mathewson
145f221e8f Define symbolic constants to use in place of SHUT_RD etc 2010-10-05 13:06:32 -04:00
Christopher Davis
e0fd87085d Send a shutdown(SHUT_WR) before closing an http connection
This avoids getting an ECONNRESET from the TCP stack.

Fixes bug 2928690
2010-10-05 13:01:54 -04:00
Nick Mathewson
0faaee0165 Fix a spurious-call bug on epoll.c
We were trying to check whether any events had really been
notified on an fd before calling evmap_io_active on it, but instead
we were checking for an event pointer, which was always true.

In practice, this patch shouldn't change much, since epoll_wait
shouldn't return an event unless there is actually an event going
on.

Spotted by an anonymous bug reporter on Sourceforge.  Closes bug
3078425.
2010-09-30 23:15:47 -04:00
Nick Mathewson
a8b7674cd5 Merge remote branch 'github/signed_compare' 2010-09-28 01:09:17 -04:00
Nick Mathewson
a78ac0facb Merge remote branch 'github/win_lib' 2010-09-27 16:05:20 -04:00
Nick Mathewson
d49b5e3326 Do not search outside of the system directory for windows DLLs
Hardens against some attacks.
2010-09-27 15:45:34 -04:00
Sebastian Hahn
b395392746 Fix compile in kqueue.c
Commit 38d09606 removed the evsigbase pointer, but forgot to remove
an assignment to it in kqueue.c.
2010-09-27 21:14:28 +02:00
Nick Mathewson
9c8db0f804 Fix all warnings in the main codebase flagged by -Wsigned-compare
Remember, the code
   int is_less_than(int a, unsigned b) {
      return a < b;
   }
is buggy, since the C integer promotion rules basically turn it into
   int is_less_than(int a, unsigned b) {
      return ((unsigned)a) < b;
   }
and we really want something closer to
   int is_less_than(int a, unsigned b) {
      return a < 0 || ((unsigned)a) < b;
   }
.

Suggested by an example from Ralph Castain
2010-09-23 22:45:55 -04:00
Nick Mathewson
045eef4cde Unit tests for listener error callbacks 2010-09-23 14:23:45 -04:00
Simon Perreault
c4be8d82b3 Add error callback to evconnlistener 2010-09-22 15:54:18 -04:00
Nick Mathewson
e1198997bc Make event.c debugging messages report fds 2010-09-21 22:44:39 -04:00
Nick Mathewson
ec2b05eddd Make debugging output for epoll backend more comprehensive 2010-09-21 22:23:32 -04:00
Nick Mathewson
90651b327a Put internal events at highest priority
(If we allow user events to starve internal events, then internal events
never actually happen, signals don't get acked, etc)
2010-09-17 00:24:50 -04:00
Nick Mathewson
38d09606ac Remove event_base.evsigbase; nothing used it. 2010-09-15 12:50:31 -04:00
Nick Mathewson
4858b7949c Remove the now-useless evsig_caught and evsig_process 2010-09-15 01:54:51 -04:00
Nick Mathewson
95a7d418ab Make default signal backend fully threadsafe
Jason Toffaletti discovered with helgrind that our signal handler was
messing with evsig_base, which can be set from lots of places in the
code.  Ordinarly, we'd just stick a lock on it, except that it is
illegal (and genuinely error-prone) to call pthread_mutex_acquire()
from inside a signal handler.

The solution is to only store the fd we write to in a static variable,
write the signal number to the fd, and put evsig_cb in charge of
activating signal events.

I have no idea how we'll cope if we want to enable this to handle
siginfo (where available) in the future.
2010-09-15 01:40:02 -04:00
Nick Mathewson
720bd933c8 Warn when using the error-prone EV_SIGNAL interface in an error-prone way. Also, fix a couple of race conditions in signal.c
When using the signal.c signal backend, Libevent currently only allows
one event_base to actually receive signals at a time.  (This has been
the behavior since at least 1.4 and probably much earlier.)  Now, we
detect and warn if you're likely to be racing about which signal goes
to which thread.

We also add a lock to control modifications of the evsig_base field,
to avoid race conditions like those found by Jason Toffaletti.

Also, more comments.  Comments are good.
2010-09-15 01:12:01 -04:00
Simon Perreault
040a019f52 Obey enabled status when unsuspending 2010-09-10 09:20:57 -04:00
Nick Mathewson
f0bd83ea88 Bump to the latest version of tinytest
This lets us do without libevent-specific code in tinytest.c, and
lets us add a feature to skip individual tests from the command
line.
2010-09-09 16:13:09 -04:00
Nick Mathewson
a5ce9ad4af Make SSL tests cover enabling/disabling EV_READ.
I want my 80% coverage.
2010-09-09 16:01:42 -04:00
Nick Mathewson
5811d74c6b Bump version to 2.0.7-rc-dev 2010-09-09 15:59:18 -04:00
Nick Mathewson
fe008ed656 Make all versioning changes for 2.0.7-rc, and add ChangeLog release-2.0.7-rc 2010-09-09 14:59:27 -04:00
Christopher Davis
d98511c027 Make event_base_virtual_del() notify the base if needed 2010-09-09 14:37:44 -04:00
Nick Mathewson
2756a10cd9 Add a missing time.h include to test/regress_thread.c 2010-09-09 13:43:31 -04:00
Nick Mathewson
fb36f9a7e5 Fix an uninitialized-variable warning on windows 2010-09-09 13:00:54 -04:00
Christopher Davis
71b6801421 Don't decrement virutal event count twice in connect_complete. 2010-09-08 20:33:21 -07:00