|
0ba0af9c
|
2011-09-29T09:30:04
|
|
Prefer mmap to sendfile unless a DRAINS_TO_FD flag is set. Allows add_file to work with SSL.
The sendfile() implementation for evbuffer_add_file is potentially more
efficient, but it has a problem: you can only use it to send bytes over
a socket using sendfile(). If you are writing bytes via SSL_send() or
via a filter, or if you need to be able to inspect your buffer, it
doesn't work.
As an easy fix, this patch disables the sendfile-based implementation of
evbuffer_add_file on an evbuffer unless the user sets a new
EVBUFFER_FLAG_DRAINS_TO_FD flag on that evbuffer, indicating that the
evbuffer will not be inspected, but only written out via
evbuffer_write(), evbuffer_write_atmost(), or drained with stuff like
evbuffer_drain() or evbuffer_add_buffer(). This flag is off by
default, except for evbuffers used for output on bufferevent_socket.
In the future, it could be interesting to make a best-effort file
segment implementation that tries to send via sendfile, but mmaps on
demand. That's too much complexity for a stable release series, though.
|
|
6acfbdd8
|
2011-08-18T12:35:27
|
|
Make overlapped reads result in evbuffer callbacks getting invoked
|
|
7484df61
|
2010-11-01T13:43:43
|
|
Fix even more win64 warnings
|
|
03afa209
|
2010-08-16T01:23:57
|
|
IOCP-related evbuffer fixes.
- Prevent evbuffer_{add,prepend}_buffer from moving read-pinned chains.
- Fix evbuffer_drain to handle read-pinned chains better.
- Raise the limit on WSABUFs from two to MAX_WSABUFS for overlapped reads.
|
|
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.
|
|
b7442f8e
|
2010-03-26T23:18:40
|
|
Replace last_with_data with a slightly smarter version
To implement evbuffer_expand() properly, you need to be able to
replace the last chunk that has data, which means that we need to keep
track of the the next pointer pointing to the last_with_data chunk,
not the last_with_data chunk itself.
|
|
2014ae4a
|
2010-03-26T14:30:14
|
|
Increase MIN_BUFFER_SIZE to 512 (1024 on 64-bit)
This constant decides the smallest (and typical) size of each evbuffer
chain. Since this number includes sizeof(evbuffer_chain) overhead,
the old value (256) was just too low: on 64-bit platforms, it would
spend nearly 20% of the allocations on overhead. The new values mean
that we'll be spending closer to 5% of evbuffer allocations on overhead.
It would be nice to get this number even lower if we can.
|
|
6f47bd12
|
2010-03-10T23:28:51
|
|
Remove previous_to_last from evbuffer
|
|
c8ac57f1
|
2010-03-10T23:24:14
|
|
Use last_with_data in place of previous_to_last
This actually makes some of the code a lot simpler. The only
ones that actually used previous_to_last for anything were reserving
and committing space.
|
|
2a6d2a1e
|
2010-03-10T22:16:14
|
|
Revise evbuffer to add last_with_data
This is the first patch in a series to replace previous_to_last with
last_with_data. Currently, we can only use two partially empty chains
at the end of an evbuffer, so if we have one with 511 bytes free, and
another with 512 bytes free, and we try to do a 1024 byte read, we
can't just stick another chain on the end: we need to reallocate the
last one. That's stupid and inefficient.
Instead, this patch adds a last_with_data pointer to eventually
replace previous_to_last. Instead of pointing to the penultimated
chain (if any) as previous_to_last does, last_with_data points to the
last chain that has any data in it, if any. If all chains are empty,
last_with_data points to the first chain. If there are no chains,
last_with_data is NULL.
The next step is to start using last_with_data everywhere that we
currently use previous_to_last. When that's done, we can remove
previous_to_last and the code that maintains it.
|
|
2c2618d8
|
2010-03-05T13:00:15
|
|
more whitespace normalization
|
|
17efc1cd
|
2010-03-04T01:25:51
|
|
Update all our copyright notices to say "2010"
|
|
e5bbd40a
|
2010-02-18T17:41:15
|
|
Clean up formatting: use tabs, not 8-spaces, to indent.
|
|
29151e65
|
2010-01-06T18:42:59
|
|
Fix byte counts when mixing deferred and non-deferred evbuffer callbacks.
This patch finishes 390e0561, which was somehow committed in a half-finished
state. It solves a failing unit test on windows.
|
|
390e0561
|
2009-12-22T15:52:02
|
|
Fix up behavior of never-defered callbacks a little
|
|
0cd3bb9f
|
2009-11-27T17:22:19
|
|
Improved optional lock debugging.
There were a couple of places in the code where we manually kept lock
counts to make sure we never accessed resources without holding a
lock, and that we never released a lock we didn't have. The
lock-debugging code already puts counts on _every_ lock when lock
debugging is enabled, so there is no need to keep these counts around
otherwise. This patch rewrites the ASSERT_FOO_LOCKED macros to all
use a common EVLOCK_ASSERT_LOCKED().
We also teach the lock debugging code to keep track of who exactly
holds each lock, so that EVLOCK_ASSERT_LOCKED() means "locked by this
thread."
|
|
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.
|
|
d7d1f1da
|
2009-11-17T20:31:09
|
|
Move responsibility for IOCP callback into bufferevent_async.
This patch from Chris Davis saves some callback depth, and adds proper
ref-counting to bufferevents when there's a deferred evbuffer callback
inflight. It could use a couple more comments to really nail down what
its invariants are.
svn:r1543
|
|
2e36dbe1
|
2009-10-26T20:00:43
|
|
Use EVUTIL_ASSERT() consistently instead of assert.
svn:r1464
|
|
b812563a
|
2009-10-16T13:20:16
|
|
Add a note that we should change previous_to_last to last_with_space
svn:r1447
|
|
e3fd294a
|
2009-10-16T13:19:57
|
|
Spelling fixes in comments and strings.
svn:r1445
|
|
b06b2649
|
2009-07-26T01:29:39
|
|
Make "deferred callback queue" independent of event_base.
This way, we can more easily have an IOCP bufferevent implementation
that does not need an event_base at all. Woot.
svn:r1381
|
|
0b22ca19
|
2009-05-22T19:11:48
|
|
Use ev_ssize_t in place of ssize_t *everywhere*.
svn:r1309
|
|
8997f234
|
2009-05-21T20:59:00
|
|
Use the native "struct iovec" as our "struct evbuffer_iovec" when available, so we do not need to copy more pointers than necessary.
svn:r1299
|
|
23243b8a
|
2009-05-19T21:39:35
|
|
Replace reserve/commit with new iovec-based interface. Add a new evbuffer_peek.
svn:r1296
|
|
dc4c7b95
|
2009-05-15T22:44:18
|
|
Change the interface of evbuffer_add_reference: give the cleanup function more info.
svn:r1294
|
|
e865eb93
|
2009-05-01T00:54:14
|
|
More msvc build tweaks.
svn:r1262
|
|
838d0a81
|
2009-04-17T06:55:08
|
|
Document many internal functions and pieces of code.
svn:r1181
|
|
93d4f884
|
2009-04-14T20:11:10
|
|
Make buffer iocp stuff compile happily
svn:r1174
|
|
9f1a94ec
|
2009-04-13T03:06:47
|
|
add pin/unpin functions, and a deref-and-free pair.
svn:r1165
|
|
dcda7915
|
2009-04-13T03:06:27
|
|
Add a reference count to evbuffers.
svn:r1164
|
|
829b52b6
|
2009-04-13T03:05:46
|
|
Refactor the code that sets up iovecs for reading into its own function. iocp needs this.
svn:r1162
|
|
b29b875d
|
2009-04-10T20:43:08
|
|
Facility to make evbuffers get their callbacks deferred.
svn:r1154
|
|
747331d1
|
2009-04-08T03:04:39
|
|
Add freeze support to evbuffers.
From the documentation:
Prevent calls that modify an evbuffer from succeeding. A buffer may
frozen at the front, at the back, or at both the front and the back.
If the front of a buffer is frozen, operations that drain data from
the front of the buffer, or that prepend data to the buffer, will
fail until it is unfrozen. If the back a buffer is frozen, operations
that append data from the buffer will fail until it is unfrozen.
We'll use this to ensure correctness on an evbuffer when we're waiting
for an overlapped IO call to finish.
svn:r1143
|
|
d9086fc0
|
2009-04-08T03:03:59
|
|
Add a new facility to "pin" the memory in an evbuffer chain.
For overlapped IO (and possibly other stuff) we need to be able to
label an evbuffer_chain as "pinned", meaning that every byte in it
must remain at the same address as it is now until it unpinned. This
differs from being "immutable": it is okay to add data to the end
of a pinned chain, so long as existing data is not moved.
svn:r1142
|
|
60e0d59b
|
2009-04-05T02:44:17
|
|
Add locking to evbuffers.
svn:r1134
|
|
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
|
|
98b7046b
|
2009-02-10T19:38:43
|
|
A few more comments on evbuffer-internal structures.
svn:r1106
|
|
8d3a10f8
|
2009-02-01T01:43:58
|
|
Support temporarily suspending an evbuffer callback. This is different from disabling the callback, since we want to process changes, but not just yet.
svn:r1091
|
|
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
|
|
8889a770
|
2009-01-27T22:30:46
|
|
Replace all use of config.h with event-config.h.
svn:r1064
|
|
fdf69493
|
2009-01-27T06:05:38
|
|
sendfile/mmap and memory reference implementation for evbuffers
svn:r1057
|
|
81dd04a7
|
2009-01-23T18:04:34
|
|
Add a "flags" field to evbuffer callbacks.
For now, there is just one: enabled. This lets us avoid lots of
mallocs/frees/tailq-manipulations just to turn a callback on and off.
The revised bufferevent code wants this.
svn:r1047
|
|
de7f7a84
|
2009-01-23T18:03:45
|
|
Remove in_callbacks check: allow full recursion in evbuffer callbacks. If you get yourself in an infinite loop, that's not our fault. Note this in the docs. Also reindent some docs now that my tabs match Niels's.
svn:r1046
|
|
c735f2b4
|
2009-01-23T01:11:13
|
|
Code to allow multiple callbacks per evbuffer.
svn:r1042
|
|
6d3ed065
|
2009-01-14T14:58:48
|
|
Simplify evbuffer_write logic: combine nearly all of WSASend and writev cases.
svn:r1004
|
|
3ca22aa8
|
2008-05-15T03:05:10
|
|
r19739@catbus: nickm | 2008-05-14 23:05:03 -0400
Use our offsetof; do not rely on platform offsetof
svn:r825
|
|
193c06a7
|
2008-03-31T02:04:34
|
|
fix a bug in which evbuffer_add_vfprintf would loop forever; avoid
fragmentation in evbuffer_expand by increasing the size of the last buffer
in the chain; as a result with have to keep track of the previous_to_last
chain; provide a evbuffer_validate() function in the regression test to
make sure that all evbuffer are internally consistent.
svn:r699
|
|
0322ce0a
|
2008-02-28T18:36:03
|
|
r18486@catbus: nickm | 2008-02-28 13:35:53 -0500
Make offsetof into evutil_offsetof. Be a little more willing to call evbuffer_chain_align() from evbuffer_expand(). Clarify some docs, and add some XXX comments to note questionable areas.
svn:r677
|
|
5c70ea4c
|
2008-02-28T02:47:43
|
|
improved code for evbuffer; avoids memcpy
svn:r674
|