Nick Mathewson
e865eb938c
More msvc build tweaks.
...
svn:r1262
2009-05-01 00:54:14 +00:00
Nick Mathewson
24607a397c
Note a place we might do better about lock releasing.
...
svn:r1252
2009-04-29 20:48:43 +00:00
Nick Mathewson
11cab33418
Fix compile: #elif FOO is not the same as #elif defined(FOO).
...
svn:r1245
2009-04-28 19:08:07 +00:00
Niels Provos
5c4c13d8c2
make sendfile work on freebsd
...
svn:r1239
2009-04-24 03:24:22 +00:00
Nick Mathewson
ec6bfd0335
Fix for evbuffer_read() when all data fits in penultimate chain.
...
Previously we were reading into the next-to-last chain, but incrementing
the fullness of the last. Bug found by Victor Goya.
svn:r1237
2009-04-23 21:41:53 +00:00
Nick Mathewson
a8f6d961eb
Actually stop using EVBUFFER_LENGTH/DATA, and move them to buffer_compat.h
...
svn:r1183
2009-04-17 06:56:09 +00:00
Nick Mathewson
93d4f884aa
Make buffer iocp stuff compile happily
...
svn:r1174
2009-04-14 20:11:10 +00:00
Nick Mathewson
0e32ba54dc
Do not remove an empty chain that we have pinned for reading when we drain the whole buffer.
...
svn:r1166
2009-04-13 03:06:59 +00:00
Nick Mathewson
9f1a94ecec
add pin/unpin functions, and a deref-and-free pair.
...
svn:r1165
2009-04-13 03:06:47 +00:00
Nick Mathewson
dcda7915ac
Add a reference count to evbuffers.
...
svn:r1164
2009-04-13 03:06:27 +00:00
Nick Mathewson
b01891fe1d
Make evbuffer_commit_space trigger callbacks.
...
svn:r1163
2009-04-13 03:06:05 +00:00
Nick Mathewson
829b52b6c1
Refactor the code that sets up iovecs for reading into its own function. iocp needs this.
...
svn:r1162
2009-04-13 03:05:46 +00:00
Nick Mathewson
b29b875d84
Facility to make evbuffers get their callbacks deferred.
...
svn:r1154
2009-04-10 20:43:08 +00:00
Nick Mathewson
747331d164
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
2009-04-08 03:04:39 +00:00
Nick Mathewson
d9086fc007
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
2009-04-08 03:03:59 +00:00
Nick Mathewson
60e0d59b33
Add locking to evbuffers.
...
svn:r1134
2009-04-05 02:44:17 +00:00
Nick Mathewson
f1b1bad415
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
2009-04-03 14:27:03 +00:00
Nick Mathewson
f90500a5df
Add a new improved search function.
...
The old evbuffer_find didn't allow iterative searching, and forced us
to repack the buffer completely every time we searched in it. The
new evbuffer_search addresses both of these. As a side-effect, the
evbuffer_find implementation is now a little more efficient.
svn:r1130
2009-04-03 01:21:36 +00:00
Nick Mathewson
01456265c3
Explode less badly in the case where we're told to prepend/append/remove a buffer to itself. Note some API/implementation deficiencies.
...
svn:r1110
2009-02-10 19:39:22 +00:00
Nick Mathewson
edfdb698e3
Add an assertion to evbuffer_chain_align so we can't reuse it in the future.
...
svn:r1105
2009-02-10 19:38:34 +00:00
Nick Mathewson
cc049bfc30
Enable (and debug) WSARecv for evbuffer iovec-like reads.
...
The two things we were missing: the flags parameter is not optional, and an error can actually indicate a close.
svn:r1100
2009-02-03 05:22:57 +00:00
Nick Mathewson
e84c765615
Allocate callback entries with contents 0d out.
...
svn:r1093
2009-02-01 05:26:47 +00:00
Nick Mathewson
8d3a10f8f1
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
2009-02-01 01:43:58 +00:00
Niels Provos
a0cae310d0
make it so that evbuffer_add_file where we read the complete contents of the file can fail without side effects
...
svn:r1069
2009-01-29 03:22:47 +00:00
Niels Provos
66b2a7ffb7
test evbuffer_add_reference
...
svn:r1068
2009-01-29 03:20:40 +00:00
Nick Mathewson
b85b710cf5
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
2009-01-27 22:34:36 +00:00
Nick Mathewson
8889a77039
Replace all use of config.h with event-config.h.
...
svn:r1064
2009-01-27 22:30:46 +00:00
Nick Mathewson
9993137cbb
Remove all trailing whitespace in all the source files.
...
svn:r1063
2009-01-27 21:10:31 +00:00
Nick Mathewson
88f2b7a00f
Fix some warnings on linux gcc with --enable-gcc-warnings
...
svn:r1060
2009-01-27 13:37:09 +00:00
Niels Provos
1757cf717f
use %zu for off_t
...
svn:r1059
2009-01-27 06:21:12 +00:00
Niels Provos
8b5bd77415
make it compile on linux
...
svn:r1058
2009-01-27 06:18:45 +00:00
Niels Provos
fdf694933c
sendfile/mmap and memory reference implementation for evbuffers
...
svn:r1057
2009-01-27 06:05:38 +00:00
Niels Provos
b93e505452
second argument to evbuffer_pullup should be ssize_t
...
svn:r1056
2009-01-27 05:33:39 +00:00
Nick Mathewson
81dd04a726
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
2009-01-23 18:04:34 +00:00
Nick Mathewson
de7f7a84a3
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
2009-01-23 18:03:45 +00:00
Nick Mathewson
ec2f4cbc09
Move obsolete evbuffer function into include/event2/buffer_compat.h
...
svn:r1043
2009-01-23 01:35:57 +00:00
Nick Mathewson
c735f2b45a
Code to allow multiple callbacks per evbuffer.
...
svn:r1042
2009-01-23 01:11:13 +00:00
Nick Mathewson
f6eb1f816c
Change evbuffer_read implementation to split data across chunks, and use readv when available. This should make us use less space.
...
svn:r1024
2009-01-19 21:53:03 +00:00
Nick Mathewson
840318196b
Make some evbuffer functions const
...
svn:r1010
2009-01-14 22:17:31 +00:00
Nick Mathewson
3552ac1eb3
Do not allow chain length to expand indefinitely.
...
svn:r1007
2009-01-14 19:39:17 +00:00
Nick Mathewson
6d3ed0657d
Simplify evbuffer_write logic: combine nearly all of WSASend and writev cases.
...
svn:r1004
2009-01-14 14:58:48 +00:00
Nick Mathewson
bab8f2e182
Fix compilation on win32 WSASend evbuffer_write() code.
...
Still not enabled until I make sure that the unit tests test this. They _do_ pass.
svn:r1003
2009-01-13 22:02:32 +00:00
Nick Mathewson
169321c9e6
Rename four internal headers to follow the -internal.h convention.
...
svn:r1000
2009-01-13 20:26:37 +00:00
Nick Mathewson
822ca048ad
Untested (and compiled-out) evbuffer_write backend to use WSASend on win32 where we use writev on unix.
...
svn:r998
2009-01-13 19:34:50 +00:00
Nick Mathewson
99db0e7f72
Add a new evbuffer_write_atmost() functino to write no more than a given number of bytes to an fd.
...
svn:r993
2009-01-12 20:42:19 +00:00
Niels Provos
e711ce454a
reintroduce a memmove when there is enough misalignment to hold the new data; otherwise the size of the buffer may grow without bounds
...
svn:r857
2008-06-21 06:10:10 +00:00
Niels Provos
9586a1cbb0
fix an evbuffer corruption when adding an empty evbuffer; from Scott Lamb
...
svn:r845
2008-06-01 16:21:24 +00:00
Nick Mathewson
c6da86ffcb
r19709@catbus: nickm | 2008-05-12 12:42:48 -0400
...
Possible fix for [1960723] snprintf and vsnprintf return values are wrong on win32
svn:r813
2008-05-12 16:44:24 +00:00
Nick Mathewson
6bf1ca780c
r19675@catbus: nickm | 2008-05-11 20:39:39 -0400
...
Stop pretending that u_char and u_short are standard types that win32 is dumb not to have. In fact, u_char can really just be spelled out, and u_short was usually just a bad way of saying ev_uint16_t.
svn:r808
2008-05-12 00:40:04 +00:00
Nick Mathewson
8acb80b4f9
r15551@tombo: nickm | 2008-05-08 14:49:20 -0400
...
Use _get_ convention for new accessor functions. (These are all new ones as of 2.0, I believe).
svn:r799
2008-05-08 22:51:39 +00:00