928 Commits

Author SHA1 Message Date
Niels Provos
edfc28caef pkgconfig support from Ted Bullock
svn:r1177
2009-04-17 00:24:58 +00:00
Nick Mathewson
0b98781353 More hacking on event_iocp.c: make it compile, and give it more of an interface. This code is now testable.
svn:r1176
2009-04-16 00:32:52 +00:00
Nick Mathewson
09c23b6a56 It seems support for GetCompletionEventEx is not in my mingw. Use the simpler interface instead, for now.
svn:r1175
2009-04-16 00:27:32 +00:00
Nick Mathewson
93d4f884aa Make buffer iocp stuff compile happily
svn:r1174
2009-04-14 20:11:10 +00:00
Nick Mathewson
fe95df15d3 Fix typo in mm_free
svn:r1173
2009-04-13 18:32:24 +00:00
Nick Mathewson
ca737ff3b5 Add draft (nonworking) versions of iocp code to hack on more.
svn:r1172
2009-04-13 18:29:31 +00:00
Nick Mathewson
4e8cdc6f08 Fix two windows compilation bugs.
svn:r1171
2009-04-13 18:23:02 +00:00
Nick Mathewson
915193e7df Locking support for bufferevents.
svn:r1170
2009-04-13 03:17:19 +00:00
Nick Mathewson
1becc4c4e6 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
2009-04-13 03:08:11 +00:00
Nick Mathewson
6567ecd4c5 Remove if0 code in bufferevent_struct.h
svn:r1168
2009-04-13 03:07:37 +00:00
Nick Mathewson
8dec59bb35 Use freeze operations to prevent shenanegans on bufferevent pair evbuffers.
svn:r1167
2009-04-13 03:07:17 +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
0b47b125cf Add a new EVUTIL_UPCAST macro so that I do not need to keep figuring out the right offsetof magic over and over.
svn:r1160
2009-04-12 22:02:54 +00:00
Nick Mathewson
bbd6a332e1 reindent macros in util-internal.h
svn:r1159
2009-04-12 22:02:12 +00:00
Niels Provos
d475fb5861 http benchmark: add a way to change the size of the buffer; also use add_reference
svn:r1158
2009-04-12 00:38:31 +00:00
Niels Provos
d2794e65e0 document evhttp_parse_query better
svn:r1157
2009-04-11 15:26:29 +00:00
Niels Provos
382a1587a0 previous commit changed the semantics of evhttp_decode_uri; need a test for that
svn:r1156
2009-04-11 04:18:49 +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
decdacfaf8 Better explanation for bufferevent_pair
svn:r1153
2009-04-10 20:42:53 +00:00
Nick Mathewson
23085c9247 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
2009-04-10 15:01:31 +00:00
Nick Mathewson
8161662007 A couple of tweaks for deferred callbacks.
svn:r1151
2009-04-10 14:58:15 +00:00
Nick Mathewson
4868f4d217 Initial support for a lightweight 'deferred callbacks'.
A 'deferred callback' is just a function that we've queued in the
event base.  This ability is needed for some mt stuff, and for complex
callback chains.  For internal use only.

svn:r1150
2009-04-10 14:22:33 +00:00
Nick Mathewson
e3d82497c9 Don't allow internal events to starve lower-priority events.
This is exceptionally important with multithreaded stuff, where we use
an event to notify the base that other events have been made active.
If the activated events have a prioirty number greater than that of the
notification event, it will starve them, and that's no good.

svn:r1149
2009-04-10 14:21:53 +00:00
Niels Provos
ce146eb1cb Fix parsing of queries where the encoded queries contained \r, \n or +
svn:r1148
2009-04-10 05:43:45 +00:00
Niels Provos
6dece3e980 revert last commit; git user error
svn:r1147
2009-04-10 05:22:15 +00:00
Niels Provos
f43f1d14c5 initial version of query decoding patch
svn:r1146
2009-04-10 05:18:18 +00:00
Nick Mathewson
f98385a407 add a missing "static" to timeout_process.
svn:r1145
2009-04-08 16:57:38 +00:00
Nick Mathewson
72b6ffe869 Prevent unsupported modifications to bufferevent_sock buffers.
In particular, we don't allow adding any data to end front of inbuf
(we do that when we read), or removing it from the front of outbuf (we
drain data only when we write).

svn:r1144
2009-04-08 03:05:42 +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
68d0139f19 Refactor the zlib and pthreads tests to appear in the regular tinytest tree structure.
svn:r1141
2009-04-07 04:49:25 +00:00
Nick Mathewson
684c022a21 Avoid a double event_del() in evdns.c.
The bug could occur when a nameserver was marked as up, but then an
outstanding probe sent to the nameserver failed.  Now, evdns_up() cancels
any outstanding probe.

svn:r1140
2009-04-06 20:38:42 +00:00
Nick Mathewson
d2e9caa6fc Fix evdns_cancel to alert callback and free associated RAM.
Also, we add a test to make sure evdns_cancel is working properly.

svn:r1139
2009-04-06 20:38:19 +00:00
Nick Mathewson
0f3c0983c0 Fix a double-delete on the request timeout event. Port from Tor.
svn:r1138
2009-04-05 17:50:18 +00:00
Nick Mathewson
28255a2635 Finally, get unit tests to pass with threading turned off again.
svn:r1137
2009-04-05 04:26:46 +00:00
Nick Mathewson
6a18f4b005 Munge the read_suspended flag before re-enabling reads on the underlying bufferevent. This makes it so the enabled thing has some idea whether reads are supposed to be suspended or not.
svn:r1136
2009-04-05 04:15:01 +00:00
Nick Mathewson
661b5eea09 Actually, move EVUTIL_NIL_STMT to util-internal.h
svn:r1135
2009-04-05 04:10:05 +00:00
Nick Mathewson
60e0d59b33 Add locking to evbuffers.
svn:r1134
2009-04-05 02:44:17 +00:00
Nick Mathewson
d13b59ce37 Fix build with thread support disabled, and make no-op macros a little more no-oppy.
svn:r1133
2009-04-05 02:44:04 +00:00
Nick Mathewson
70ee390fc9 Add some more utility macros to evthread-internal.h
svn:r1132
2009-04-05 02:43:55 +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
0afb1f7ffb Glibc mkstemp requires exactly 6 Xs.
svn:r1129
2009-04-01 16:08:34 +00:00
Niels Provos
994e85781c correct evbuffer_drain documentation from John Khvatov
svn:r1127
2009-03-30 17:36:22 +00:00
Niels Provos
23655dfb87 include Doxyfile in tar ball; from Jeff Garzik
svn:r1125
2009-03-12 17:43:43 +00:00
Nick Mathewson
73094d5952 Make tmpfile code compile without warnings
svn:r1123
2009-02-13 13:43:35 +00:00