summaryrefslogtreecommitdiff
path: root/bufferevent-internal.h
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Include evconfig-private.h in internal files for great good.Kevin Bowling2011-01-021-0/+1
|/ /
* | bufferevent-internal.h: Use the new event2/util.h header, not evutil.hEvan Jones2010-12-021-1/+1
| |
* | Try to clear up more size_t vs int/long issues.Nick Mathewson2010-10-271-4/+4
| |
* | Make rate-limits go up to SIZE_MAX/EV_SSIZE_MAX, not just INT32_MAXNick Mathewson2010-10-261-1/+1
| | | | | | | | | | | | | | | | 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.
* | Correct logic on disabling underlying bufferevents when disabling a filterNick Mathewson2010-10-141-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Fix all warnings in the main codebase flagged by -Wsigned-compareNick Mathewson2010-09-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Move event-config.h to include/event2Nick Mathewson2010-08-061-1/+1
| | | | | | | | | | This change means that all required include files are in event2, and all files not in event2/* are optional.
* | Fix unused-variable warning when building with threads disabledNick Mathewson2010-05-081-0/+6
| |
* | Merge commit 'chrisd/connect-hostname-report-err'Nick Mathewson2010-05-061-0/+3
|\ \
| * | Report DNS error when lookup fails during bufferevent_socket_connect_hostname.Christopher Davis2010-04-241-0/+3
| |/
* | Remove redundant checks for lock!=NULL before calling EVLOCK_LOCKNick Mathewson2010-04-281-4/+2
|/ | | | | | | | | | | | | 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?
* Functions to track the total bytes sent over a rate limit group.Nick Mathewson2010-03-211-0/+7
|
* Improve robustness for refcountingNick Mathewson2010-03-131-4/+5
| | | | | Document that we do intend to double-decref underlying bufferevents under some circumstances. Check to make sure that we don't decref past 0.
* more whitespace normalizationNick Mathewson2010-03-051-2/+2
|
* Update all our copyright notices to say "2010"Nick Mathewson2010-03-041-1/+1
|
* deal with connect() failing immediatelyNiels Provos2010-02-271-0/+3
|
* Provide consistent, tested semantics for bufferevent timeoutsNick Mathewson2010-02-231-0/+5
| | | | | | | | | | | | | | | | 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.
* Merge remote branch 'github/split_free_from_decref'Nick Mathewson2010-02-231-2/+2
|\
| * Make bufferevent_free() clear all callbacks immediately.Nick Mathewson2010-02-221-2/+2
| | | | | | | | | | | | | | | | | | | | 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().
* | Suspend read/write on bufferevents during hostname lookupNick Mathewson2010-02-201-0/+3
|/ | | | | | 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.
* Clean up formatting: use tabs, not 8-spaces, to indent.Nick Mathewson2010-02-181-2/+2
|
* Fix a number of warnings from gcc -pedanticNick Mathewson2010-01-231-1/+1
|
* Check more internal event_add() calls for failureNick Mathewson2010-01-221-3/+3
| | | | | | | | | 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.
* Do not make bufferevent_setfd implicitly disable EV_READ and EV_WRITE.Nick Mathewson2009-12-281-3/+0
| | | | This obviates the need for BEV_SUSPEND_CONNECTING, and good riddance.
* Rate-limiting for bufferevents; group and individual limits are supported.Nick Mathewson2009-12-281-8/+77
| | | | | | 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.
* Replace some cases of uint32_t with ev_uint32_t.Nick Mathewson2009-12-231-3/+3
| | | | Spotted by Roman Puls.
* Do not ignore bufferevent_enable(EV_READ) before bufferevent_connect().Nick Mathewson2009-12-231-0/+3
| | | | | Previously, we weren't remembering that we wanted to re-add the read event once the connect was finished. Now we are.
* Fix a segfault when freeing SSL bufferevents in an unusual orderJoachim Bauch2009-12-181-0/+2
| | | | | | Have container bufferevents hold a reference to their underlying bufferevents. (Commit message and minor revisions by nickm.)
* Refactor our 'suspend operation' logic on bufferevents.Nick Mathewson2009-12-041-8/+52
| | | | | | | | | | | | | | | 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.
* Stop passing EVTHREAD_READ and EVTHREAD_WRITE to non-rw locks.Nick Mathewson2009-11-271-2/+2
| | | | | | | | | | | | | 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.
* Add two implementations of getaddrinfo: one blocking and one nonblocking.Nick Mathewson2009-11-161-11/+0
| | | | | | | | | | | | | 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
* Commit ConnectEx code to get connect working with async bufferevents.Nick Mathewson2009-11-041-0/+11
| | | | | | | | 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
* Add a bufferevent function to resolve a name then connect to it.Nick Mathewson2009-11-031-0/+11
| | | | | | | | | | | 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
* Spelling fixes in comments and strings.Nick Mathewson2009-10-161-4/+4
| | | | svn:r1445
* Bufferevent support for openssl.Nick Mathewson2009-07-281-0/+5
| | | | | | | | | | | | | | | | | 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
* Always hold a reference to a bufferevent when calling its callbacks.Nick Mathewson2009-07-171-0/+3
| | | | | | | | | | 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
* Consistently say "eventcb" instead of "errorcb"Nick Mathewson2009-05-251-3/+3
| | | | svn:r1316
* Add documentation for bufferevent-internal.h stuffNick Mathewson2009-05-251-0/+35
| | | | svn:r1315
* Add a generic mechanism to implement timeouts in bufferevents.Nick Mathewson2009-05-251-0/+32
| | | | | | | | | | | 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
* Add a "ctrl" mechanism to bufferevents for property access.Nick Mathewson2009-05-131-0/+14
| | | | | | | | | | | | 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
* Add new code to make and accept connections.Nick Mathewson2009-05-051-0/+1
| | | | | | | | | 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
* Add a generic way for any bufferevent to make its callback deferredNick Mathewson2009-04-171-0/+11
| | | | svn:r1197
* Add reference counts to bufferevents.Nick Mathewson2009-04-171-0/+2
| | | | svn:r1189
* Locking support for bufferevents.Nick Mathewson2009-04-131-0/+19
| | | | svn:r1170
* Refactor new elements of bufferevent into bufferevent_private structureNick Mathewson2009-04-131-1/+17
| | | | | | | | 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
* Add a linked-pair abstraction to bufferevents.Nick Mathewson2009-04-101-2/+3
| | | | | | | | | | | | | 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
* checkpoint work on big bufferevent refactoringNick Mathewson2009-02-021-13/+49
| | | | svn:r1095
* Update copyright statements to reflect the facts that:Nick Mathewson2009-01-271-2/+1
| | | | | | | | | 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
* Replace all use of config.h with event-config.h.Nick Mathewson2009-01-271-1/+1
| | | | svn:r1064
* support input/output filters for buffereventsNiels Provos2008-04-301-0/+61
svn:r748