bufferevent-internal.h


Log

Author Commit Date CI Message
Nick Mathewson e49e2891 2012-02-10T17:29:53 Update copyright notices to 2012
Nick Mathewson 3c824bd3 2011-10-24T13:18:09 Update copyright dates to 2011.
Nick Mathewson e6af35d7 2011-08-24T21:39:28 Correctly terminate IO on an async bufferevent on bufferevent_free
Nick Mathewson 6d5440e8 2011-08-11T15:15:17 Fix handling of group rate limits under 64 bytes of burst The "min_share" logic, which was designed to prevent piles of extremely small writes when running up against a group rate limit, could lead to confusing behavior if you ever set a min_share less than your burst rate. If that happened, then as soon as your group rate limit was exhausted, you'd stop reading/writing, and never start again, since the amount readable/writeable would never actually hit min_share. We now cap min_share at the rate per tick. Found by George Kadianakis
Nick Mathewson c8baac90 2011-03-07T21:55:47 Followup for Tomash Brechko's http patch This patch makes bufferevent_disable_hard() non-public, and adds a comment about what it's for and why it's used.
Evan Jones ef5e65a4 2010-12-02T10:27:06 bufferevent-internal.h: Use the new event2/util.h header, not evutil.h
Nick Mathewson 598d1336 2010-10-27T22:57:53 Try to clear up more size_t vs int/long issues.
Nick Mathewson 2cbb1a16 2010-10-26T10:27:29 Make rate-limits go up to SIZE_MAX/EV_SSIZE_MAX, not just INT32_MAX Someday, when networks are far faster and people frequently want a burst value greater than 2GB per tick, this will seem very forsightful indeed. For now, it breaks ABI, but not source. Fixes bug 3092096.
Nick Mathewson ac27eb82 2010-10-08T00:59:02 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.
Nick Mathewson 9c8db0f8 2010-09-23T22:45:55 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
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 ad811cdc 2010-05-08T16:41:01 Fix unused-variable warning when building with threads disabled
Nick Mathewson a62c8433 2010-05-06T14:16:50 Merge commit 'chrisd/connect-hostname-report-err'
Nick Mathewson 50ec59f4 2010-04-28T15:16:32 Remove redundant checks for lock!=NULL before calling EVLOCK_LOCK The EVLOCK_LOCK and EVLOCK_UNLOCK macros already check to make sure that the lock is present before messing with it, so there's no point in checking the lock before calling them. A good compiler should be able to simplify code like if (lock) { if (lock) acquire(lock); } , but why count on it?
Christopher Davis 0ef40706 2010-04-24T00:06:38 Report DNS error when lookup fails during bufferevent_socket_connect_hostname.
Nick Mathewson fb366c1d 2010-03-21T13:16:31 Functions to track the total bytes sent over a rate limit group.
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 2c2618d8 2010-03-05T13:00:15 more whitespace normalization
Nick Mathewson 17efc1cd 2010-03-04T01:25:51 Update all our copyright notices to say "2010"
Niels Provos 7bc48bfd 2010-02-27T18:59:06 deal with connect() failing immediately
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 4b37e6a5 2010-02-23T00:39:02 Merge remote branch 'github/split_free_from_decref'
Nick Mathewson b2fbeb3f 2010-02-22T15:38:23 Make bufferevent_free() clear all callbacks immediately. This should end the family of bugs where we call bufferevent_free() while a pending callback is holding a reference on the bufferevent, and the callback tries to invoke the user callbacks before it releases its own final reference. This means that bufferevent_decref() is now a separate function from bufferevent_free().
Nick Mathewson db08f640 2010-02-20T12:55:59 Suspend read/write on bufferevents during hostname lookup When we're doing a lookup in preparation for doing a connect, we might have an unconnected socket on hand, and mustn't actually do any reading or writing with it.
Nick Mathewson e5bbd40a 2010-02-18T17:41:15 Clean up formatting: use tabs, not 8-spaces, to indent.
Nick Mathewson 918e9c5e 2010-01-23T16:38:36 Fix a number of warnings from gcc -pedantic
Nick Mathewson ff3f6cd4 2010-01-22T16:14:49 Check more internal event_add() calls for failure Most of these should be unable to fail, since adding a timeout generally always works. Still, it's better not to try to be "too smart for our own good here." There are some remaining event_add() calls that I didn't add checks for; I've marked those with "XXXX" comments.
Nick Mathewson 82743794 2009-12-24T17:47:14 Do not make bufferevent_setfd implicitly disable EV_READ and EV_WRITE. This obviates the need for BEV_SUSPEND_CONNECTING, and good riddance.
Nick Mathewson 737c9cd8 2009-11-27T13:16:54 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.
Nick Mathewson a47d88d7 2009-12-23T07:53:19 Replace some cases of uint32_t with ev_uint32_t. Spotted by Roman Puls.
Nick Mathewson 4a5b5343 2009-12-23T07:48:43 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.
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 0d744aa1 2009-11-23T18:34:32 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.
Nick Mathewson 76cd2b70 2009-11-27T16:44:47 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.
Nick Mathewson 86f57420 2009-11-16T22:25:46 Add two implementations of getaddrinfo: one blocking and one nonblocking. The entry points are evutil_getaddrinfo and evdns_getaddrinfo respectively. There are fairly extensive unit tests. I believe this code conforms to RFC3493 pretty closely, but there are probably more issues. It should get tested on more platforms. This code means we can dump the well-intentioned but weirdly-implemented bufferevent_evdns and evutil_resolve code. svn:r1537
Nick Mathewson 86db1c85 2009-11-04T05:19:26 Commit ConnectEx code to get connect working with async bufferevents. This is code by Chris Davis, with changes to get the unit tests failing less aggressively. The unit tests for this code do not completely pass yet; Chris is looking into that. If they aren't passing by the next release, I'll turn off this code. svn:r1499
Nick Mathewson 0b9eb1bf 2009-11-03T20:40:48 Add a bufferevent function to resolve a name then connect to it. This function, bufferevent_socket_connect_hostname() can either use evdns to do the resolve, or use a new function (evutil_resolve) that uses getaddrinfo or gethostbyname, like http.c does now. This function is meant to eventually replace the hostname resolution mess in http.c. svn:r1496
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 2f655f00 2009-05-25T23:10:47 Add documentation for bufferevent-internal.h stuff svn:r1315
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 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 659d54d5 2009-05-05T02:59:26 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. svn:r1272
Nick Mathewson a98a512b 2009-04-17T23:12:34 Add a generic way for any bufferevent to make its callback deferred svn:r1197
Nick Mathewson 91039e4d 2009-04-17T06:57:38 Add reference counts to bufferevents. svn:r1189
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 ea4b8724 2009-02-02T19:22:13 checkpoint work on big bufferevent refactoring svn:r1095
Nick Mathewson b85b710c 2009-01-27T22:34:36 Update copyright statements to reflect the facts that: a) this is 2009 b) niels and nick have been comaintainers for a while c) saying "all rights reserved" when you then go on to explicitly disclaim some rights is sheer cargo-cultism. svn:r1065
Nick Mathewson 8889a770 2009-01-27T22:30:46 Replace all use of config.h with event-config.h. svn:r1064
Niels Provos 682adc44 2008-04-30T00:09:16 support input/output filters for bufferevents svn:r748