bufferevent_filter.c


Log

Author Commit Date CI Message
Nick Mathewson ec347b92 2010-07-07T16:45:03 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.
Nick Mathewson 657d1b6d 2010-03-13T01:06:57 Set mem_offset for every bufferevent type
Nick Mathewson f1bc125e 2010-03-12T23:00:49 Improve robustness for refcounting Document that we do intend to double-decref underlying bufferevents under some circumstances. Check to make sure that we don't decref past 0.
Nick Mathewson 17efc1cd 2010-03-04T01:25:51 Update all our copyright notices to say "2010"
Nick Mathewson d3288293 2010-02-20T18:44:35 Provide consistent, tested semantics for bufferevent timeouts The different bufferevent implementations had different behavior for their timeouts. Some of them kept re-triggering the timeouts indefinitely; some disabled the event immediately the first time a timeout triggered. Some of them made the timeouts only count when the bufferevent was actively trying to read or write; some did not. The new behavior is modeled after old socket bufferevents, since they were here first and their behavior is relatively sane. Basically, each timeout disables the bufferevent's corresponding read or write operation when it fires. Timeouts are stopped whenever we suspend writing or reading, and reset whenever we unsuspend writing or reading. Calling bufferevent_enable resets a timeout, as does changing the timeout value.
Nick Mathewson 4faeaea9 2010-02-19T03:39:50 Clean up formatting: function/keyword spacing consistency. - Keywords always have a space before a paren. Functions never do. - No more than 3 blank lines in a row.
Nick Mathewson e5bbd40a 2010-02-18T17:41:15 Clean up formatting: use tabs, not 8-spaces, to indent.
Nick Mathewson 8fdf09c0 2010-02-18T17:08:50 Clean up formatting: Disallow space-before-tab.
Nick Mathewson 2e8eeea3 2009-12-29T19:50:03 Fix crash bugs when a bufferevent's eventcb is not set. In many places throughout the code, we called _bufferevent_run_eventcb without checking whether the eventcb was actually set. This would work fine when the bufferevent's callbacks were deferred, but otherwise the code would segfault. Strangely, we always remembered to check before calling the _bufferevent_run_{read,write}cb functions. To prevent similar errors in the future, all of _buferevent_run_{read,write,event}cb now check to make sure the callback is actually set before invoking or deferring the callback. This patch also removes the now-redundant checks for {read,write}cb.
Joachim Bauch a773df54 2009-12-18T16:24:41 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.)
Nick Mathewson 784b8773 2009-11-06T21:46:57 We do not work any more without an event-config.h; stop pretending that it is meaningful to check for HAVE_CONFIG_H svn:r1516
Nick Mathewson 2e36dbe1 2009-10-26T20:00:43 Use EVUTIL_ASSERT() consistently instead of assert. svn:r1464
Nick Mathewson b73ad7bc 2009-10-21T18:48:22 Treat the bitwise OR of two enum values as an int. This makes our interfaces usable from C++, which doesn't believe you can say "bufferevent_socket_nase(base, -1, BEV_OPT_CLOSE_ON_FREE|BEV_OPT_DEFER_CALLBACKS)" but which instead would demand "static_cast<bufferevent_options>(BEV_OPT_CLOSE_ON_FREE| BEV_OPT_DEFER_CALLBACKS))" for the last argument. Diagnosis and patch from Chris Davis. svn:r1456
Nick Mathewson e3fd294a 2009-10-16T13:19:57 Spelling fixes in comments and strings. svn:r1445
Nick Mathewson 709c21c4 2009-07-28T04:03:57 Bufferevent support for openssl. This code adds a new Bufferevent type that is only compiled when the openssl library is present. It supports using an SSL object and an event alert mechanism, which can either be an fd or an underlying bufferevent. There is still more work to do: the unit tests are incomplete, and we need to support flush and shutdown much better. Sometimes events are generated needlessly: this will hose performance. There's a new encrypting proxy in sample/le-proxy.c. This code has only been tested on OSX, and nowhere else. svn:r1382
Nick Mathewson a62283a9 2009-07-17T17:46:17 Always hold a reference to a bufferevent when calling its callbacks. Rationale: we hold a lock on the bufferevent when its callbacks are executing, so we need to release the lock afterwards. But the callback might free the bufferevent, so unless we're holding a reference on the bufferevent, the lock might not be there for us to release. svn:r1347
Nick Mathewson 5232cfa3 2009-05-25T23:11:20 Consistently say "eventcb" instead of "errorcb" svn:r1316
Nick Mathewson 34574db0 2009-05-25T23:10:23 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]. svn:r1314
Nick Mathewson 0b22ca19 2009-05-22T19:11:48 Use ev_ssize_t in place of ssize_t *everywhere*. svn:r1309
Nick Mathewson 31d89f27 2009-05-13T20:37:21 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. svn:r1284
Nick Mathewson 5a3eddf0 2009-05-02T16:24:05 Use fewer _compat.h headers in our own code. svn:r1268
Nick Mathewson eda27f95 2009-04-19T20:54:12 Update copyright notices, add some missing license statements svn:r1208
Nick Mathewson a98a512b 2009-04-17T23:12:34 Add a generic way for any bufferevent to make its callback deferred svn:r1197
Nick Mathewson a8f6d961 2009-04-17T06:56:09 Actually stop using EVBUFFER_LENGTH/DATA, and move them to buffer_compat.h svn:r1183
Nick Mathewson 915193e7 2009-04-13T03:17:19 Locking support for bufferevents. svn:r1170
Nick Mathewson 1becc4c4 2009-04-13T03:08:11 Refactor new elements of bufferevent into bufferevent_private structure This way we don't expose more of a bufferevent than we need to. One motivation is to make it easier to automatically get deferred callbacks with a bufferevent without exposing the deferred_cb structure. svn:r1169
Nick Mathewson 23085c92 2009-04-10T15:01:31 Add a linked-pair abstraction to bufferevents. The new bufferevent_pair abstraction works like a set of buferevent_sockets connected by a socketpair, except that it doesn't require a socketpair, and therefore doesn't need to get the kernel involved. It's also a good way to make sure that deferred callbacks work. It's a good use case for deferred callbacks: before I implemented them, the recursive relationship between the evbuffer callback and the read callback would make the unit tests overflow the stack. svn:r1152
Nick Mathewson f1b1bad4 2009-04-03T14:27:03 Make the new evbuffer callbacks use a new struct-based interface. The old interface would fail pretty hard when we had to batch up multiple adds and drains in a single call. svn:r1131
Nick Mathewson ac36f404 2009-02-11T05:17:27 oops; coding too quickly on nil-filter patch. Caught by niels. svn:r1115
Nick Mathewson 20f809ce 2009-02-10T19:39:12 Make default (nil) filter use evbuffer_remove_buffer to respect the high-water mark of the target buffer. svn:r1109
Nick Mathewson 3502a472 2009-02-02T21:24:04 convert new bufferevent_*.c files to event-config.h only. svn:r1097
Nick Mathewson ea4b8724 2009-02-02T19:22:13 checkpoint work on big bufferevent refactoring svn:r1095