Log

Author Commit Date CI Message
Nick Mathewson b34abf30 2010-03-12T18:36:18 Do not close(-1) when freeing an uninitialized socket bufferevent
Nick Mathewson 70a44b61 2010-03-12T18:35:15 Avoid a spurious close(-1) on Linux On Linux, we use only one fd to do main-thread signaling (since we have eventfd()), so we don't need to close th_notify_fd[1] as we would if we were using a socketpair.
Nick Mathewson 75018951 2010-03-13T00:23:06 Fix a possible double-free bug in SSL bufferevents with CLOSE_ON_FREE With CLOSE_ON_FREE set, we were telling the BIO to free the bufferevent when it was closed, and also freeing it ourselves.
Nick Mathewson 0d047c3f 2010-03-13T00:29:15 Fix an obnoxious typo in the bufferevent_timeout_filter test We were using the same bufferevent as the child of two filtering parents, orphaning another. This made one get freed twice, and the other not at all. Possible fix for bug 2963306 spotted by Doug Cuthbertson.
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 6c83e6c9 2010-03-12T12:26:06 Merge branch 'evbuffer_insert_point'
Nick Mathewson ee41aca6 2010-03-12T00:46:39 Functions to manipulate existing rate limiting groups. This patch adds a function to change the current rate limit of a rate limiting group, and another to free an empty rate limiting group.
Nick Mathewson cdd4c490 2010-03-11T00:38:46 Try to comment some of the event code more
Nick Mathewson 17da042d 2010-03-11T15:39:44 Add some glass-box tests for the last_with_data code.
Nick Mathewson 1e7b9868 2010-03-11T14:23:02 Fix last_with_data compilation on windows
Nick Mathewson 78772c35 2010-03-11T00:18:02 Clarify Christopher Clark's status as writer of original ht code.
Nick Mathewson e470ad3c 2010-03-10T23:39:30 Allow evbuffer_read() to split across more than 2 iovecs Previously it would only accept 2 iovecs at most, because our previous_to_last nonsense didn't let it take any more. This forced us to do more reallocations in some cases when an extra small malloc would have sufficed.
Nick Mathewson 6f47bd12 2010-03-10T23:28:51 Remove previous_to_last from evbuffer
Nick Mathewson 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.
Nick Mathewson 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.
Nick Mathewson c7f1b820 2010-03-10T21:21:33 Merge branch 'evport'
Nick Mathewson b2f2be6e 2010-03-10T16:25:16 Make evdns use the regular logging system by default Once, for reasons that made sense at the time, we had evdns.c use its own logging subsystem with two levels, "warn" and "debug". This leads to problems, since setting a log handler for Libevent wouldn't actually trap these messages, since they weren't on by default, and since some of the warns should really be msgs. This patch changes the default behavior of evdns.c to log to event_(debugx,warnx,msgx) by default, and adds a new (internal-use-only) log level of EVDNS_LOG_MSG. Programs that set a evdns logging function will see no change. Programs that don't will now see evdns warnings reported like other warnings.
Brodie Thiesfield 13e4f3bd 2010-03-08T13:46:48 Avoid errors in http.c when building with VC 2003 .NET
Brodie Thiesfield b677032b 2010-03-08T13:46:04 Avoid errors in evutil.c when building with _UNICODE defined
Nick Mathewson 2c2618d8 2010-03-05T13:00:15 more whitespace normalization
Nick Mathewson c7cf6f00 2010-03-05T12:47:46 Replace users of "int fd" with "evutil_socket_t fd" in portable code Remeber, win32 has a socket type that's actually a handle, so if there's a chance that code is run on win32, we can't use "int" as the socket type. This isn't a blind search-and-replace: sometimes an fd is really in fact for a file, and not a socket at all.
Nick Mathewson 38b7b571 2010-03-04T01:40:32 Add Christopher Clark and Maxim Yegorushkin to the LICENSE file
Nick Mathewson 17efc1cd 2010-03-04T01:25:51 Update all our copyright notices to say "2010"
Nick Mathewson cc1600af 2010-03-02T17:00:06 Improve the speed of evbuffer_readln() This makes some cases of bench_http about 5% faster. Our internal evbuffer_strpbrk() function was overly general (it tried to handle all character sets when we only used it for "\r\n"), and not very efficient (it called memchr once for each character in the buffer until it found a \r or a \n). It actually showed up in some profiles for HTTP testing, since evbuffer_readln() calls it when doing loose CRLF detection. This patch replaces it with a faster implementation.
Nick Mathewson 2fac0f70 2010-03-03T12:15:15 Remove signal_assign() and signal_new() macros. These were introduced and deprecated in the same version (2.0.1-alpha), presumably in two-stage process. Everybody sane should be using evsignal_assign() and evsignal_new() instead.
Christopher Davis 1273d2f5 2010-03-02T15:16:28 VC has no getopt(), so do without in bench_http.
Christopher Davis 4ac38a5c 2010-03-02T14:34:30 Get bench_http to work on Windows; add a switch to enable IOCP.
Nick Mathewson bf3bfd0c 2010-03-01T22:12:04 Revert the broken part of 2cffd6c937 It looks like I accidentally removed most of WIN32-Code/event-config.h when I was bumping the version. Fortunately, this happened when I bumped to 2.0.4-alpha-dev rather than when I bumped to 2.0.4-alpha. :) This patch restores the deleted parts of WIN32-Code/event-config.h
Nick Mathewson 22aff049 2010-03-01T22:06:12 Distribute libevent.pc.in, not libevent.pc
Nick Mathewson 2cffd6c9 2010-02-28T16:53:42 Bump version to 2.0.4-alpha-dev
Nick Mathewson 9669ade5 2010-02-28T12:55:29 Bump the version to 2.0.4-alpha
Nick Mathewson 3a5cfb0d 2010-02-28T12:49:03 Add a changelog for 2.0.4-alpha from Git, sorted by hand
Nick Mathewson ad85908a 2010-02-28T12:52:39 Fix compilation with --disable-debug-mode
Nick Mathewson 57b72488 2010-02-27T22:27:13 Small cleanups on freebsd-connect-refused patch. There should be no need to call be_socket_enable: that does an event_add(). What we really want to do is event_active(), to make sure that the writecb is executed. Also, there was one "} if () {" that was missing an else. I've noted that the return value for evutil_socket_connect() is getting screwy, but since that isn't an exported function, we can fix it whenever.
Niels Provos 7bc48bfd 2010-02-27T18:59:06 deal with connect() failing immediately
Nick Mathewson 98edb891 2010-02-25T17:14:41 Fix arc4random compilation on MSVC.
Nick Mathewson 1e14f826 2010-02-25T17:11:28 Try to define a sane _EVENT_SIZEOF_SIZE_T for msvc compilation
Nick Mathewson 23170a69 2010-02-25T16:57:57 Fix mingw compilation
Nick Mathewson 7ffd3875 2010-02-24T13:40:06 Delete stack-alloced event in new unit test before returning.
Nick Mathewson f3dfe462 2010-02-23T23:59:26 Use new timeval diff comparison function in bufferevent test
Nick Mathewson 8fcb7a1b 2010-02-23T23:55:32 Add test for periodic timers that get activated for other reasons This was already independently verified by the new bufferevent timeout tests, but it's good to explicitly check that our code does what it should.
Nick Mathewson c02bfe12 2010-02-23T16:36:52 Add a test for timeouts on filtering bufferevents.
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 38ec0a77 2010-02-23T14:24:10 Fix a bug in resetting timeouts on persistent events when IO triggers. When we fixed persistent timeouts to make them reset themselves based on the previous scheduled time rather than the current time... we made them do so regardless of whether the event was triggering because of a timeout or not! This was of course bogus. When a _timeout_ triggers, we should schedule the event for N seconds based on the last _schedule_ time... but when IO triggers, we should reset the timeout for N seconds after now.
Nick Mathewson e2642f0a 2010-02-23T15:14:57 Fix some race conditions in persistent events and event_reinit I found these by adding an EVENT_BASE_ASSERT_LOCKED() call to most of the functions in event.c that can only be called while holding the lock. event_reinit() never grabbed the lock, but it needed to. event_persist_closure accessed the base to call event_add_internal() and gettime() when its caller had already dropped the lock. event_pending() called gettime() without grabbing the lock.
Nick Mathewson 4b37e6a5 2010-02-23T00:39:02 Merge remote branch 'github/split_free_from_decref'
Nick Mathewson 162ce8a8 2010-02-23T00:38:30 Expose view of current rate limit as constrained by group limit
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 4faeaea9 2010-02-19T03:39:50 Clean up formatting: function/keyword spacing consistency. - Keywords always have a space before a paren. Functions never do. - No more than 3 blank lines in a row.
Nick Mathewson e5cf9879 2010-02-18T17:46:56 Clean up formatting: remove trailing spaces
Nick Mathewson e5bbd40a 2010-02-18T17:41:15 Clean up formatting: use tabs, not 8-spaces, to indent.
Nick Mathewson 8fdf09c0 2010-02-18T17:08:50 Clean up formatting: Disallow space-before-tab.
Nick Mathewson 7515de91 2010-02-18T14:50:44 When connect() succeeds immediately, don't invoke the callback immediately. We need this to get unit tests to pass on freebsd.
Nick Mathewson b72be50d 2010-02-18T13:52:04 Add some headers to fix freebsd compilation
Nick Mathewson 1ba6bed8 2010-02-18T13:50:15 Add the "compile" script to gitignore.
Nick Mathewson 48a29b68 2010-02-18T01:43:37 Add a unit test for secure rng. Mostly, this is just to make sure our arc4random_buf() implementation isn't dumb.
Nick Mathewson ff2a134d 2010-02-18T00:54:44 Fix getpid() usage on Windows On Windows, getpid() is _getpid(), and requires that we first include <process.h>. arc4random.c previously didn't know that. Actually, I question whether arc4random needs to do its getpid() tricks on Windows. They exist only so that we remember to re-seed the ARC4 cipher whenever we fork... but Windows has no fork(), so I think we're in the clear.
Nick Mathewson cb52838f 2010-02-18T00:27:35 When working without a current event base, don't try to use IOCP listeners This fixes a bug turned up with the http unit tests, where we create the evhttp object using an implicit (NULL) event_base. This failed pretty badly when we tried to use IOCP-based listeners. We could hunt for the current base from inside listener.c in the future, or get the iocp base some other way, but for now this is probably the safest solution.
Nick Mathewson 32c6f1ba 2010-02-15T19:54:15 Construct Windows locks using InitializeCriticalSectionAndSpinCount Previously we were using InitializeCriticalSection, which creates a lock that blocks immediately on contention and waits to be rescheduled. This is inefficient; it's better to wait for a little while before telling the US to reschedule us, in case the lock becomes available again really soon (since most locks mostly do). Good pthreads implementations do this automatically. On Windows, though, we need to call this magic function, and we need to pick the spin count ourselves.
Nick Mathewson ca46d25b 2010-02-17T23:02:28 Merge branch 'arc4random'
Nick Mathewson e15e1e94 2010-02-17T22:54:43 Add the arc4random.c license to the LICENSE file.
Nick Mathewson 7116bf23 2010-02-15T21:03:52 Fix two unlocked reads in evbuffer. Some initializers (in evbuffer_read and evbuffer_commit) were reading the last and/or previous_to_last fields without grabbing the evbuffer lock. This may fix a hard-to-trigger race condition or two.
Nick Mathewson aae7db52 2010-02-15T17:53:24 Update event-config.h version number to match configure.in
Nick Mathewson 60753da0 2010-02-15T17:07:26 Merge commit 'niels/http_close_connection'
Nick Mathewson 63e868e6 2010-02-15T16:45:19 Increment the submicro version number. We've changed a couple of APIs introduced in 2.0.1-alpha, so it behooves us to give high-needs apps (like Tor) a way to tell we've done this. Sensible apps will just say "is it 2.0.3-alpha or 2.0.4-alpha" and ignore the existence of 2.0.3-alpha-dev, which is just as it should be.
Niels Provos 2f782af3 2010-02-13T17:04:17 validate close cb on server when client connection closes
Niels Provos e8a9782c 2010-02-13T16:59:37 clean up terminate_chunked test
Nick Mathewson 4ec8fea6 2010-02-13T00:11:44 Make RNG work when we have arc4random() but not arc4random_buf()
Nick Mathewson 3fe60fdf 2010-02-12T23:40:13 Use off_t for the length parameter of evbuffer_add_file
Nick Mathewson d4de062e 2010-02-10T17:19:18 Add an arc4random implementation for use by evdns Previously, evdns was at the mercy of the user for providing a good entropy source; without one, it would be vulnerable to various active attacks. This patch adds a port of OpenBSD's arc4random() calls to Libevent [port by Chris Davis], and wraps it up a little bit so we can use it more safely.
Nick Mathewson 1dd7e6dc 2010-02-05T01:16:23 Remove the 'flags' argument from evdns_base_set_option() The 'flags' argument made sense when passed to evdns_(base_)?parse_resolv_conf when it said which parts of the resolv.conf file to obey. But for evdns_set_option(), it was really silly, since you wouldn't be calling evdns_set_option() unless you actually wanted to set the option. Its meaning was basically, "set this to DNS_OPTIONS_ALL unless you want a funny surprise." evdns_base_set_option was new in 2.0.1-alpha, so we aren't committed to keeping it source-compatible.
Nick Mathewson 6810bdb1 2010-02-05T13:50:51 Always use our own gai_strerror() replacement. This is necessary if we have any errors that the platform gai_strerror() doesn't know how to handle.
Nick Mathewson c18490e6 2010-02-05T01:09:01 Add a check to make soure our EVUTIL_AI flags do not conflict with the native ones
Nick Mathewson cfe7a9ff 2010-02-04T10:15:39 Merge remote branch 'niels/http_chunk'
Nick Mathewson a7a94310 2010-02-03T23:49:22 Fix some additional -DUNICODE issues on win32. Brodie's patch didn't catch the ones that were new since 1.4.
Brodie Thiesfield 000a33ec 2010-02-03T23:27:40 Make Libevent 1.4.12 build on win32 with Unicode enabled. This patch fixes calls to the win32 api to explicitly call the char* versions of the functions. This fixes build failures when libevent is built with the UNICODE define.
Niels Provos 39781801 2010-02-03T16:54:18 make evhttp_send() safe against terminated connections, too
Nick Mathewson e2d15d81 2010-02-03T17:52:55 Merge remote branch 'niels/http_chunk'
Niels Provos 93d73691 2010-02-03T14:34:56 do not fail while sending on http connections the client closed. when sending chunked requests via multiple calls to evhttp_send_reply_chunk, the client may close the connection before the server is done sending. this used to cause a crash. we introduce a new function evhttp_request_get_connection() that allows the server to determine if the request is still associated with a connection. If it's not, evhttp_request_free() needs to be called explicitly or the user can call evhttp_send_reply_end() which just frees the request, too.
Nick Mathewson 60742d58 2010-02-03T17:01:45 Add the rest of the integer limits, and add a test for them.
Nick Mathewson 8f654678 2010-02-03T16:25:34 Merge remote branch 'github/http_listener' Conflicts: http.c
Nick Mathewson 85047a69 2010-02-03T15:12:04 Functions to view and manipulate rate-limiting buckets. We need these for Tor, and other projects probably need them too. Uses include: - Checking whether bandwidth is mostly-used, and only taking some actions when there's plenty of bandwidth. - Deducting some non-bufferevent activities from a rate-limit group.
Nick Mathewson aba1fff3 2010-02-03T14:37:42 Add EV_*_MAX macros to event2/util.h to expose limits for ev_* types.
Nick Mathewson da6135e3 2010-02-03T02:09:19 Reduce windows header includes in our own headers. It turns out that absolutely everything that was including windows.h was doing so needlessly; our headers don't need it, so we should just include winsock2.h (since that's where struct timeval is defined). Pre-2.0 code will use the old headers, which include windows.h for them, so we aren't breaking source compatibility with 1.4. This solves the bug where we were leaving WIN32_LEAN_AND_MEAN defined, in roughly the same way that buying an automobile solves the question of what to give your coachman for boxing day.
Nick Mathewson 27c9a40f 2010-02-03T02:08:08 Fix a dumb typo in ev_intptr_t definitions. We said "#define ev_uintptr_t" twice instead of ever saying "#define ev_intptr_t".
Nick Mathewson e244a2ea 2010-02-03T01:26:07 Add the msvc-generated .lib files to .gitignore.
Nick Mathewson 6c21c895 2010-02-03T01:22:44 Remove EVUTIL_CHECK_FMT. This was never supposed to be an exposed API, so its name should have been more like _EVUTIL_CHECK_FMT. But it was only used in one place, so let's just eliminate it.
Nick Mathewson f6b26949 2010-02-03T01:16:47 Deprecate EVENT_FD and EVENT_SIGNAL. These are old aliases for event_get_fd and event_get_signal, and they haven't been the preferred way of doing things since 2.0.1-alpha. For a while, we made them use struct event if it was included, but call event_get_(fd|signal) if it wasn't. This was entirely too cute.
Nick Mathewson d38a7a19 2010-02-02T15:44:10 const-ify a few more functions in event.h
Nick Mathewson f4190bfb 2010-01-27T01:47:36 Update time-test.c to use event2 time-test.c wasn't crazy, but it used some old interfaces. There are probably more cleanups and explanations to do beyond the ones here.
Nick Mathewson d60a1bd5 2010-01-27T01:46:41 Clarify status of example programs (That is, add comments to say that dns-example and le-proxy are recent and ugly; event-test is old and ugly.)
Nick Mathewson becb9f9c 2010-01-27T01:46:23 Add a new "hello world" sample program
Nick Mathewson 137f2c60 2010-01-26T12:08:34 Try to fix a warning in hash_debug_entry Apparently some 64-bit platforms don't like it when you say unsigned hash(void *p) { return (unsigned)p; } even if you really honestly don't want the high bits of p. Perhaps they will tolerate it if I say the equivalent of unsigned hash(void *p) { return (unsigned) (uintptr_t) p; }
Nick Mathewson cef61a2f 2010-01-26T12:08:17 Use ev_[u]intptr_t types in place of [u]intptr_t
Nick Mathewson 1fa4c81c 2010-01-26T12:06:41 Add ev_[u]intptr_t to include/event2/util.h We already emulate most of the other useful bits of stdint.h, and we seem to have started to use uintptr_t in a few places throughout the code. Let's make sure we can continue to do so even on backwards platforms that don't do C99.
Nick Mathewson 439aea0d 2010-01-25T14:07:01 Try to untangle the logic in server_port_flush(). The logic that prevented the first loop in this function from being infinite was rather confusing and hard to follow. It seems to confuse some automatic analysis tools as well as me. Let's try to replace it with something more comprehensible.
Nick Mathewson 361da8f2 2010-01-25T13:54:14 Note a missing ratelim function
Nick Mathewson a66e947b 2010-01-25T13:44:56 Use less memory for each entry in a hashtable Our hash-table implementation stored a copy of the hash code in each element. But as we were using it, all of our hash codes were ridiculously easy to calculate: most of them were just a matter of a load and a shift. This patch lets ht-internal be built in either of two ways: one caches the hash-code for each element, and one recalculates it each time it's needed. This patch also chooses a slightly better hash code for event_debug_entry.
Nick Mathewson a19b4a05 2010-01-25T13:38:07 Call event_debug_unassign on internal events I don't expect that many users will be so religious about calling unassign, but we need to be so that it's at least possible to use debug mode without eating memory.