Log

Author Commit Date CI Message
Gilad Benjamini b84b598e 2010-04-21T01:15:19 Clean up properly when adding a signal handler fails. Previously, when a signation() or signal() call failed, we would free the element we added to sh_old, but not actually clear the pointer. This would leave a dangling pointer in sh_old that could cause a crash later.
Sebastian Sjöberg 899c1dcc 2010-04-14T15:42:57 Replace EVUTIL_CLOSESOCKET macro with a function The EVUTIL_CLOSESOCKET() macro required you to include unistd.h in your source for POSIX. We might as well turn it into a function: an extra function call is going to be cheap in comparison with the system call. We retain the EVUTIL_CLOSESOCKET() macro as an alias for the new evutil_closesocket() function. (commit message from email by Nick and Sebastian)
Nick Mathewson 0861d170 2010-04-14T14:41:03 Add ctags/etags files to .gitignore
Shuo Chen 755fbf16 2010-04-14T14:27:29 Add void* arguments to request_new and reply_new evrpc hooks This makes evprc setup more extensible, and helps with Shuo Chen's work on implementing Google protocol buffers rpc on top of Libevent 2 evrpc. This patch breaks binary compatibility with previous versions of Libevent, since it changes struct evrpc and the signature of evrpc_register_generic(). Since all compliant code should be calling evrpc_register_generic via EVRPC_REGISTER, it shouldn't break source compatibility. (Code by Shuo Chen; commit message by Nick)
Shuo Chen 07edf784 2010-04-14T14:23:03 Expose the request and reply members of rpc_req_generic() This code adds two accessor functions to evprc, and helps integrate evrpc with Google protocol buffers. (Code by Shuo Chen; commit message by nickm)
Nick Mathewson a0983b67 2010-04-14T00:36:09 Initialize last_with_datap correctly in evbuffer_overlapped Fixes bug 2985406
Giuseppe Scrivano 10c4c904 2010-04-12T12:50:17 Do not inhibit automake dependencies generation It fixes make parallel builds.
Giuseppe Scrivano 3cbca866 2010-04-12T12:52:31 Create shared libraries under Windows
Giuseppe Scrivano d469c503 2010-04-12T12:18:57 Fix compiler warnings under WIN32
Nick Mathewson ab30e553 2010-04-13T01:46:29 Merge branch 'evbuffer_copyout'
Nick Mathewson eb86c8c5 2010-04-12T22:24:54 Add evbuffer_copyout to copy data from an evbuffer without draining The evbuffer_remove() function copies data from the front of an evbuffer into an array of char, and removes the data from the buffer. This function behaves the same, but does not remove the data. This behavior can be handy for lots of protocols, where you want the evbuffer to accumulate data until a complete record has arrived. Lots of people have asked for a function more or less like this, and though it isn't too hard to code one from evbuffer_peek(), it is apparently annoying to do it in every app you write. The evbuffer_peek() function is significantly faster, but it requires that the user be able to handle data in separate extents. This patch also reimplements evbufer_remove() as evbuffer_copyout() followed by evbuffer_drain(). I am reasonably confident that this won't be a performance hit: the memcpy() overhead should dominate the cost of walking the list an extra time.
Christopher Davis fd902740 2010-04-10T11:26:53 Merge branch 'safetimevalms'
Christopher Davis 8f9e60c8 2010-04-09T19:16:09 Always round up when there's a fractional number of msecs.
Nick Mathewson 819f949f 2010-04-09T19:16:49 Limit the maximum number of events on each socket to 65535 This lets us use less RAM for the evmap_io structure, which in turn can let us have fewer cache misses for evmap operations.
Nick Mathewson 99210dd9 2010-04-09T19:14:25 Merge branch 'comment'
Nick Mathewson c247adc7 2010-04-09T13:32:08 Add a few more evmap/changelist comments
Nick Mathewson 1234b95a 2010-04-09T17:19:39 Test another case of evbuffer_prepend
Nick Mathewson 8c83e995 2010-04-09T16:40:53 Add more unit tests for evbuffer_expand
Nick Mathewson 06a4443a 2010-04-09T15:28:26 Unit-test every evbuffer_add_file() implementation. Previously, we'd only test the default one, even if the others were still compiled in.
Christopher Davis 28bfed47 2010-04-02T19:08:32 Clean up a mistake in pointer manipulation in evbuffer_remove
Christopher Davis 850c3ff2 2010-03-31T20:30:55 Add evutil_tv_to_msec for safe conversion of timevals to milliseconds. This is useful for backends that require their timeout values be in milliseconds.
Nick Mathewson d5ebcf37 2010-03-30T16:47:37 Rewrite evbuffer_expand and its users The previous evbuffer_expand was not only incorrect; it was inefficient too. On all questions of time vs memory tradeoffs, it chose to burn time in order to avoid wasting memory. The new code tries to be a little more balanced: it only resizes an existing chain when doing so doesn't require too much copying, and when failing to do so would waste a lot of the chain's space. This patch also rewrites evbuffer_chain_insert to work properly with last_with_datap, and adds a few convenience functions to buffer.c.
Nick Mathewson 45068a31 2010-03-31T12:03:43 Fix a memory leak when appending/prepending to a buffer with unused space.
Nick Mathewson 8e227b04 2010-03-27T00:09:25 Make the no_iovecs case of write_atmost compile Apparently nobody had tested it before on a system that had sendfile. Why would you have sendfile and not writev? Perhaps you're trying to test the no-iovecs code to make sure it still works.
Nick Mathewson 96865c47 2010-03-30T12:48:56 Turn the increasingly complex *_CHAIN() macros into functions
Nick Mathewson 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.
Nick Mathewson cda56abf 2010-03-31T12:29:26 Fix critical bug in evbuffer_write when writev is not available evbuffer_pullup() returns NULL if you try to pull up more bytes than are there. But evbuffer_write_atmost would sometimes ask for more bytes to be pulled up than it had, get a NULL, and fail.
Nick Mathewson c87272b7 2010-03-26T14:51:39 Make evbuffer_prepend handle empty buffers better If the first chunk of a buffer is empty, and we're told to prepend to the buffer, we should be willing to use the entire first chunk. Instead, we were dependent on the value of chunk->misalign.
Nick Mathewson 5c0ebb33 2010-03-26T14:50:45 Do not use evbuffer_expand() to add the first chain to a buffer (It's a big function, and using it this way is overkill.)
Nick Mathewson 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.
Nick Mathewson 6f20492f 2010-03-26T14:20:10 Fix a free(NULL) in minheap-internal.h
Nick Mathewson a5276180 2010-03-26T13:56:01 Fix minheap code to use replacement malloc functions minheap-internal.h still had an extra realloc and an extra free that needed to be replaced with mm_realloc and mm_free().
Nick Mathewson 7204b916 2010-03-26T13:46:29 Remove a needless min_heap_shift_up_() call Previously, every call to min_heap_shift_down_() would invoke min_heap_shift_up_() at the end. This used to be necessary in the first version of the minheap code, since min_heap_erase() would call min_heap_shift_down_() unconditionally. But when patch 8b7a3b36763 from Marko Kreen fixed min_heap_erase() to be more sensible, we left the weird behavior of min_heap_shift_down_() in place. Fortunately, "cui" noticed this and reported it on Niels's blog.
Patrick Galbraith e1e703d2 2010-03-23T16:04:59 Make evutil_signal_active() match declaration.
Trond Norbye 3eb044d0 2010-03-23T13:27:10 Never test for select() on windows On 64-bit windows, configure actually _finds_ select when it tests for it, and due to the ordering of the io implementations in event.c it is chosen over the win32select implementation. This modification skips the test for select on win32 (we don't want that anyway, because Windows has its own), causing my windows box to get the win32select implementation. (edited by Nick)
Nick Mathewson 7960af51 2010-03-22T13:37:39 Merge branch 'build'
Nick Mathewson 9eb2fd75 2010-03-22T13:27:47 Use dist_bin_SCRIPTS, not EXTRA_DIST, to distribute scripts
Jardel Weyrich 83986414 2010-03-12T06:04:56 Fix infrequent memory leak in bufferevent_init_common().
Nick Mathewson b557b175 2010-03-21T13:28:48 Detect and refuse reentrant event_base_loop() calls Calling event_base_loop on a base from inside a callback invoked by that same base, or from two threads at once, has long been a way to get exceedingly hard-to-diagnose errors. This patch adds code to detect such reentrant invocatinos, and exit quickly with a warning that should explain what went wrong.
Nick Mathewson fb366c1d 2010-03-21T13:16:31 Functions to track the total bytes sent over a rate limit group.
Nick Mathewson 33874b05 2010-03-16T13:37:15 Make 'main/many_events' test 70 fds, not 64. This is mainly intended to ensure that we don't get hung up on the 64-handle limit that lots of O(n) Windows functions (but FWICT not select) like to enforce.
Nick Mathewson 657d1b6d 2010-03-13T01:06:57 Set mem_offset for every bufferevent type
Nick Mathewson 0cf1431e 2010-03-13T01:04:30 Avoid an (untriggerable so far) crash bug in bufferevent_free() We were saying mm_free(bufev - bufev->be_ops->mem_offset); when we should have said mm_free(((char*)bufev) - bufev->be_ops->mem_offset); In other words, if mem_offset had ever been nonzero, then instead of backing up mem_offset bytes to find the thing we were supposed to free, we would have backed up mem_offset*sizeof(struct bufferevent) bytes, and freed something completely crazy. Spotted thanks to a conversation with Jardel Weyrich
Nick Mathewson 274a7bd9 2010-03-13T00:55:39 Fix some memory leaks in the unit tests These don't matter except inasmuch as they give real memory leaks a place to hide. Found with valgrind
Nick Mathewson 859af677 2010-03-13T00:53:54 Free evdns_base->req_heads on evdns_base_free It looks like when we moved from one big inflight-requests list to an n-heads structure, we didn't make evdns_base_free() free the array of heads. This patch should fix that. Found with valgrind
Nick Mathewson 68dc742b 2010-03-12T20:38:25 Fix a write of uninitialized RAM in regression tests Not actually harmful, but not something we should be doing. Found by valgrind.
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 77c917de 2010-03-12T14:37:54 Give a better warning for bad automake versions. If you tried to build with automake-1.6 or earlier, we would previously spit out pages and pages of garbage output. Now, automake should just say "Hey, I'm not new enough for this."
Nick Mathewson 0794b0d2 2010-03-12T14:21:52 Remove an orphaned RELEASE flag in Makefile.am
Nick Mathewson 2e898f54 2010-03-12T14:16:30 Switch to using AM conditionals in place of AC_LIBOBJ AC_LIBOBJ is really only meant for defining missing library functions, not conditional code compilation. Sticking our conditionally compiled modules in SYS_SRC should make stuff easier to maintain.
Nick Mathewson b660edf9 2010-03-12T13:22:47 Remove redundant stuff from EXTRA_DIST To a first approximation, sources that are mentioned anywhere in an automake file don't need to get mentioned in EXTRA_DIST.
Nick Mathewson 426c8fbe 2010-03-12T13:09:28 Support the standard 'make check' target in place of 'make verify' Based on patch 2816088 from Zack Weinberg
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.