While commas at the end of enumerator lists are valid in c99, they
are not valid +in c89 nor in c++. When using gcc/g++ with the
-pedantic flag, users will +receive a warning (gcc) or an
error(g++) when including the event2/event.h and
+event2/bufferevent.h. The errors look something like
event2/event.h:159: error: comma at end of enumerator list
Nick Mathewson [Wed, 27 May 2009 15:35:00 +0000 (15:35 +0000)]
Activate fd events in a pseudorandom order on older backends.
New backends like poll and kqueue and so on add fds to the queue in
the order that they are triggered. But the select backend currently
activates low-numbered fds first, whereas the poll and win32 backends
currently favor whatever fds have been on for the longest. This is no
good for fairness.
Nick Mathewson [Mon, 25 May 2009 23:10:23 +0000 (23:10 +0000)]
Add a generic mechanism to implement timeouts in bufferevents.
Paired and asynchronous bufferevents didn't do timeouts, and filtering
bufferevents gave them funny semantics. Now they all should all work
in a way consistent with what socket bufferevents do now: a [read/write]
timeout triggers if [reading/writing] is enabled, and if the timeout is
set, and the right amount of time passes without any data getting
[added to the input buffer/drained from the output buffer].
Nick Mathewson [Fri, 22 May 2009 18:20:59 +0000 (18:20 +0000)]
Fix a potentially very annoying evdns bug that we found in Tor.
Generally speaking, it way better to event_assign() an event when you
allocate it than to assign it before every time you event_add it: if
it is already event_add()ed, the assign will mess it up so that it
doesn't _look_ added, and event_add() will insert a second copy.
Later, event_del() will only delete the second copy. Eventually, the
event_base will have a dangling pointer to freed memory. Ouch!
Nick Mathewson [Fri, 22 May 2009 14:48:40 +0000 (14:48 +0000)]
Try to contain the failure when we are running without socketpair().
Some win32 systems (mostly those using Kaspersky, it would seem)
prevent us from faking socketpair(). This makes our signal
notification code just not work. Our response since 1.4 has been to
assert. For users who would rather work without signals than not work
at all, this has been a regression from 1.3e.
This patch makes adding signal events fail in this case; there's no
reason to kill the whole process.
Nick Mathewson [Fri, 15 May 2009 20:23:59 +0000 (20:23 +0000)]
New semantics for evbuffer_cb_set_flags().
Previously, set_flags() would replace all previous user-visible flags.
Now it just sets the flags, and there is a clear_flags() function to
clear other flags.
Nick Mathewson [Wed, 13 May 2009 20:37:21 +0000 (20:37 +0000)]
Add a "ctrl" mechanism to bufferevents for property access.
OpenSSL uses something like this to implement get/set access for
properties on its BIOs, so that it doesn't need to add a pair of
get/set functions to the vtable struct for every new abstract property
it provides an accessor for.
Doing this lets us make bufferevent_setfd abstract, and implement an
abstract bufferevent_getfd.
Nick Mathewson [Wed, 13 May 2009 20:36:56 +0000 (20:36 +0000)]
Do not use the "evbuffer_" prefix to denote parts of bufferevents.
This is a bit of an interface doozy, but it's really needed in order
to be able to document this stuff without apologizing it. This patch
does the following renamings:
Nick Mathewson [Tue, 5 May 2009 16:52:37 +0000 (16:52 +0000)]
Make unit tests for bufferevent_async compile and _almost_ work.
Either I need to make the callbacks get deferred in a base with no events (doable), or I need to make it okay to call launch_read from inside the callback for read (tricky).
Nick Mathewson [Tue, 5 May 2009 02:59:26 +0000 (02:59 +0000)]
Add new code to make and accept connections.
This is stuff that it's easy to get wrong (as I noticed when writing
bench_http), and that takes up a fair amount of space (see http.c).
Also, it's something that we'll eventually want to abstract to use
IOCP, where available.
Nick Mathewson [Thu, 23 Apr 2009 05:40:06 +0000 (05:40 +0000)]
Fix c89 bugs reported by Cory Stup.
Others may remain. I wasn't able to get gcc --std=c89 to build libevent
at all, so I don't know what compiler the original reporter is using here.
Note that this change requires us to disable the part of our rpc code
that uses variadic macros when using a non-gcc compiler. This is a
problem if we want our rpc api to be portable.
Nick Mathewson [Thu, 23 Apr 2009 00:21:23 +0000 (00:21 +0000)]
Use signal.h, not sys/signal.h.
This is patch 2673214 from mmadia. It is correct, since we unconditionally
include signal.h in many other places, and only sometimes include sys/signal.h.
It is necessary to compile on Haiku, I'm told.
Nick Mathewson [Thu, 23 Apr 2009 00:01:24 +0000 (00:01 +0000)]
Fix min_heap_erase when we remove an element from the middle of the heap.
Previously, we could lose the heap property when we removed an item
whose parent was greater than the last element in the heap. We would
replace the removed item with the last element, and consider shifting
it down, but we wouldn't consider shifting it up.