Log

Author Commit Date CI Message
Nick Mathewson 0f7144fd 2009-12-07T17:21:13 Refactor code from evdns into a new internal "read a file" function.
Nick Mathewson eaaf27f1 2010-01-06T18:41:46 Enable branch-prediction hints with EVUTIL_UNLIKELY. This had been accidentally disabled. Since it seems to work with GCC, I'm turning it back on when GCC is present.
Nick Mathewson 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.
Nick Mathewson ba2945f9 2010-01-06T17:59:44 Merge branch 'ratelimit' Conflicts: bufferevent_async.c
Jardel Weyrich 0546ce11 2009-12-30T05:03:54 Eradicated the last free() call. Let mm_free() take care of deallocation.
Nick Mathewson 165d30e3 2009-12-30T14:29:56 Fix compilation of rate-limiting code on win32.
Nick Mathewson 885b4273 2009-12-30T13:50:52 Fix test-ratelim compilation on Linux. I'd forgotten to include time.h, and to link against libm.
Nick Mathewson 78ed0972 2009-12-30T11:58:36 Never believe that we have pthreads on win32, even if gcc thinks we do. Apparently some newer versions of mingw provide a fake pthreads api to let applications work even if they don't know about windows threading. That's nice, but we aren't one of those.
Nick Mathewson 2e8eeea3 2009-12-29T19:50:03 Fix crash bugs when a bufferevent's eventcb is not set. In many places throughout the code, we called _bufferevent_run_eventcb without checking whether the eventcb was actually set. This would work fine when the bufferevent's callbacks were deferred, but otherwise the code would segfault. Strangely, we always remembered to check before calling the _bufferevent_run_{read,write}cb functions. To prevent similar errors in the future, all of _buferevent_run_{read,write,event}cb now check to make sure the callback is actually set before invoking or deferring the callback. This patch also removes the now-redundant checks for {read,write}cb.
Nick Mathewson 0b151a9f 2009-12-29T18:11:52 Whitespace fixes in test.sh
Nick Mathewson 7dfbe94a 2009-12-29T18:07:51 Allow test.sh to be run as ./test/test.sh
Nick Mathewson c382de64 2009-12-29T17:59:55 Allow the user to redirect the verbose output of test/test.sh to a file By default, the test.sh script still suppresses the output of all the tests it invokes. Now, however, you can have that output written to a file specified in the TEST_OUTPUT_FILE shell variable.
Nick Mathewson 1e56a32d 2009-12-29T16:04:16 Make the initial nameserver probe timeout configurable. When we decide that a nameserver is down, we stop sending queries to it, except to periodically probe it to see if it has come back up. Our previous probe sechedule was an ad-hoc and hard-wired "10 seconds, one minute, 5 minues, 15 minutes, 1 hour, 1 hour, 1 hour...". There was nothing wrong with having it be ad-hoc, but making it hard-wired served no good purpose. Now the user can set the initial timeout via a new "initial-probe-timeout:" option; future timeouts back off by a factor of 3 on every failure to a maximum of 1 hour. As a side-benefit, this lets us cut the runtime of the dns/retry test from about 40 seconds to about 3 seconds. Faster unit tests are always a good thing.
Nick Mathewson ee4953f8 2009-12-29T16:03:30 Fix the code that allowed DNS options to not end with : We tried to fix this in 0.2.0.3-alpha, but our fix was buggy.
Jardel Weyrich d0939d2b 2009-12-29T16:21:26 Introduced evutil_make_socket_closeonexec() to preserve fd flags for F_SETFD. Use this to eliminate the various macros that called F_SETFD throughout the code.
Jardel Weyrich 4df7dbcb 2009-12-29T16:19:24 Adjusted fcntl() retval comparison on evutil_make_socket_nonblocking(). Apparently, a successful return value on F_SETFL is "anything but -1".
Nick Mathewson 82743794 2009-12-24T17:47:14 Do not make bufferevent_setfd implicitly disable EV_READ and EV_WRITE. This obviates the need for BEV_SUSPEND_CONNECTING, and good riddance.
Nick Mathewson f0c0124e 2009-12-23T07:54:13 Testing code for bufferevent rate-limiting. This is not part of the regression tests, since running it necessarily takes a while. There is a new test-ratelim test; run it with '-h' for an argument to see its options.
Nick Mathewson 737c9cd8 2009-11-27T13:16:54 Rate-limiting for bufferevents; group and individual limits are supported. The fairness algorithms are not the best, not every bufferevent type is supported, and some of the locking tricks here are simply absurd. Still, this code should be a good first step.
Nick Mathewson 47854a80 2009-12-28T01:40:37 Expose our cached gettimeofday value with a new interface I've got a two use case that wants this for a fairly sensible purpose: one external and on internal.
Jardel Weyrich 5a43df82 2009-12-28T16:03:47 Improve readability of evutil_unparse_protoname()
Jardel Weyrich 0d64051f 2009-12-28T16:01:59 Fix a bogus free in evutil_new_addrinfo()
Jardel Weyrich 24fb502f 2009-12-28T16:01:12 Fix an fd leak in evconnlistener_new_bind().
Jardel Weyrich 4c8b7cdc 2009-12-28T16:00:05 Make evutil_make_socket_nonblocking() leave any other flags alone. Fixes bug 2922121
Dagobert Michelsen fee2c779 2009-12-28T15:53:01 Fix compilation of devpoll.c by adding missing thread includes. (Bug 2922156)
Nick Mathewson a47d88d7 2009-12-23T07:53:19 Replace some cases of uint32_t with ev_uint32_t. Spotted by Roman Puls.
Nick Mathewson 4a5b5343 2009-12-23T07:48:43 Do not ignore bufferevent_enable(EV_READ) before bufferevent_connect(). Previously, we weren't remembering that we wanted to re-add the read event once the connect was finished. Now we are.
Nick Mathewson 390e0561 2009-12-22T15:52:02 Fix up behavior of never-defered callbacks a little
Nick Mathewson 5846bf6c 2009-12-22T15:51:39 Simplify the read high-watermark checking.
Nick Mathewson c69d5a5d 2009-12-22T12:03:46 Remove the contents of WIN32-Prj as unmaintained. Makefile.nmake is now the preferred way to build with MSVC; the project files haven't worked properly in ages.
Nick Mathewson 292467c0 2009-12-22T00:58:52 Use evutil_socket_t, not int, when logging socket errors.
unknown c51bb3c3 2009-12-21T16:36:40 Fix a few locking issues on windows.
Nick Mathewson 5a112d3c 2009-12-18T23:37:50 Set all instances of the version number correctly. Note that we've made two subtle mistakes: we are supposed to suffix any non-released version with "-dev", and we're supposed to use the last byte of the numeric version to indicate whether we have done this. For example, when 2.0.4-alpha is released, its numeric versin will be 0x 02 00 04 00. As soon as we tag it, we will change the version in the git repository to 2.0.4-alpha-dev, whose numeric version will be 0x 02 00 04 01 or something.
Nick Mathewson 67995270 2009-12-18T17:04:37 Drop install-sh from our git repo: a mismatched version could break "make dist"
Joachim Bauch a773df54 2009-12-18T16:24:41 Fix a segfault when freeing SSL bufferevents in an unusual order Have container bufferevents hold a reference to their underlying bufferevents. (Commit message and minor revisions by nickm.)
Joachim Bauch a6adeca7 2009-12-17T12:38:46 Fix a segfault when writing a very fragmented evbuffer onto an SSL Fixes bug 2916328.
Evan Jones f6430ac1 2009-12-08T17:02:24 Update sample/signal-test.c to use newer APIs and not leak.
Joachim Bauch ea6b1df2 2009-12-08T15:38:34 Only define _GNU_SOURCE if it is not already defined.
Sebastian Hahn 70cdfe49 2009-12-06T02:59:19 Fix compile on Snow Leopard with gcc warnings enabled
Nick Mathewson 7ae94450 2009-12-04T16:37:43 Fix a snow leopard compile warning in the unit tests. Reported by Sebastian Hahn.
Nick Mathewson 0d744aa1 2009-11-23T18:34:32 Refactor our 'suspend operation' logic on bufferevents. There are lots of things we do internally in bufferevents to indicate "the user would like this operation to happen, but we aren't going to try until some other condition goes away." Our logic here has gotten entirely too complicated. This patch tries to fix that by adding the idea of 'suspend flags' for read and write. To say "don't bother reading or writing until condition X no longer holds," bufferevent_suspend_read/write(bev, BEV_SUSPEND_X). When X no longer holds, call bufferevent_unsuspend_read/write(bev, BEV_SUSPEND_X). Right now, only the read-watermark logic uses this.
Nick Mathewson 438f9ed2 2009-11-23T15:53:24 Add the abilitity to mark some buffer callbacks as never-deferred.
Nick Mathewson 689fc091 2009-11-28T11:31:39 New EVTHREAD_TRY_LOCK function to try to grab a lock.
Nick Mathewson 2b7abf03 2009-12-04T13:49:27 Merge commit 'niels/dnscrash'
Yasuoka Masahiko 6c7c5799 2009-12-04T10:44:46 Fix a crash when reading badly formatted resolve.conf; from Yasuoka Masahiko
unknown b62d979b 2009-12-02T01:24:37 Update nmake makefile to build evthread.c
unknown 31687b4d 2009-12-02T01:22:07 Fix regress_iocp.c usage of old lock allocation macros.
Roman Puls bd6f1bab 2009-12-02T01:15:15 Fix up evthread compilation on windows
William Ahern 56771a3e 2009-11-29T10:20:46 Valgrind fix: Clear struct kevent before checking for OSX bug. William's original commit message: Valgrind complains on startup because kq_init passes to kevent only a partially initialized structure. The code doesn't expect kevent to look at .fflags, .udata, or .data, I suppose, because it merely tickles the kernel looking for an error response. But perhaps that's unwarranted chuminess (notwithstanding that it's checking for an OS X bug), and needless noise nonetheless.
Nick Mathewson 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."
Zhuang Yuyao 2df1f82b 2009-11-27T16:02:49 Fix an evdns lock violation. Original message: evdns contains a bug related to thread lock. enable thread lock by evthread_use_pthreads() will cause successive evdns_base_resolve_ipv4() (and other resolve functions i think) to hang on EVDNS_LOCK(base) after one or several successful call to evdns_base_resolve_ipv4().
Nick Mathewson da1718b2 2009-11-27T16:00:59 Fix a locking bug in event_base_loop() We previously were releasing the lock when we exited the main loop in some ways, but not in others.
Nick Mathewson d84d8385 2009-11-27T15:24:32 Fix two use-after-free bugs in unit tests spoted by lock debugging
Nick Mathewson 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.
Nick Mathewson 347952ff 2009-11-27T15:20:43 Revise the locking API: deprecate the old locking callbacks and add trylock. Previously, there was no good way to request different kinds of lock (say, read/write vs writeonly or recursive vs nonrecursive), or for a lock function to signal failure (which would be important for a trylock mode). This patch revises the lock API to be a bit more useful. The older lock calls are still supported for now. We also add a debugging mode to catch common errors in using the locking APIs.
Nick Mathewson e1ffbb82 2009-11-21T01:11:49 Fix memory-leak of signal handler array with kqueue. It turns out that kqueue_dealloc wasn't calling evsig_dealloc() (because it doesn't use the main signal handler logic) so the sh_old array was leaking. This patch also introduces a fix in evsig_dealloc() where we set the sh_old array to NULL when we free it, so that main/fork can pass.
Nick Mathewson 07e9e9b4 2009-11-20T16:50:55 Parenthesize macro arguments more aggressively
Nick Mathewson f32b5750 2009-11-20T16:38:01 Add a warning about the use of event_initialized.
Nick Mathewson 91fe23fc 2009-11-20T15:46:04 Tolerate code that returns from a fatal_cb. Also, replace more abort() calls with EVUTIL_ASSERT() or event_errx.
Nick Mathewson 94d00651 2009-11-20T12:56:29 Add stub header for 2.0.4-alpha changelog.
Nick Mathewson 0af10d56 2009-11-20T12:46:00 Add more people who wrote patches to the acknowledgments The names came from grepping ChangeLog for 'patch/code from/by'.
Nick Mathewson 0b427268 2009-11-20T12:37:47 Improve the README with more information and links. (Also, try to test out the new commit script.)
Nick Mathewson ba340714 2009-11-20T12:17:14 Add a .gitignore file. .gitignore plays the same role in Git as the svn:ignore property does in subversion.
Niels Provos 505040a2 2009-11-20T00:18:35 call it 2.0.3-alpha svn:r1556
Niels Provos f1691539 2009-11-19T23:08:50 Remove most calls to event_err() in http and deal with memory errors instead svn:r1555
Niels Provos 986500de 2009-11-19T22:02:33 nick found a race condition in the pthreads test case svn:r1554
Niels Provos b8f222e0 2009-11-19T21:14:31 On FreeBSD and other OSes, connect can return ECONREFUSED immediately; instead of failing the function call, pretend with faileld in the callback. svn:r1553
Nick Mathewson bdfe72f3 2009-11-19T00:21:48 Documentation adjustments svn:r1552
Nick Mathewson 7511b6a9 2009-11-19T00:21:38 Fix a spelling error and remove some dead code svn:r1551
Nick Mathewson f070a4ae 2009-11-18T23:18:55 Do the proper hack for the (Open)BSD getaddrinfo quirk. From evutil.c: Some older BSDs (like OpenBSD up to 4.6) used to believe that giving a numeric port without giving an ai_socktype was verboten. We test for this so we can apply an appropriate workaround. If it turns out that the bug is present, then: - If nodename==NULL and servname is numeric, we build an answer ourselves using evutil_getaddrinfo_common(). - If nodename!=NULL and servname is numeric, then we set servname=NULL when calling getaddrinfo, and post-process the result to set the ports on it. We test for this bug at runtime, since otherwise we can't have the same binary run on multiple BSD versions. svn:r1550
Nick Mathewson 07ce7f99 2009-11-18T21:17:00 Make our failing-connection bufferevent test more tolerant. I thought we had a way to do connect() that would never fail immediately, but always wait for a moment before failing. It turns out that on FreeBSD it can fail immediately. This is not FreeBSD's fault, or even a real bug anywhere but in the unit test. svn:r1549
Nick Mathewson cf749e22 2009-11-18T21:16:53 Add a temporary workaround for an ssl bug found on FreeBSD. Basically, we only want to report the 'connected' event because of the socket connect() finishing when we have an actual socket bufferevent; on an SSL bufferevent, 'connected' means 'SSL connection finished.' This isn't FreeBSD's fault: it just has a connect() that tends to succeed pretty early. svn:r1548
Nick Mathewson 9bf124bf 2009-11-18T21:16:47 Build correctly with mm replacement turned off. svn:r1547
Nick Mathewson 767eb70f 2009-11-18T21:16:33 Fix compilation with threading disabled. svn:r1546
Nick Mathewson 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
Nick Mathewson 201d8d0b 2009-11-17T18:29:44 Clarify even more about various system-specific problems with getaddrinfo svn:r1542
Nick Mathewson 9151d000 2009-11-17T03:36:43 Use the common-case code from getaddrinfo_common *always*; OS differences are just too huge. svn:r1541
Nick Mathewson 3451c870 2009-11-17T02:57:32 Never pass our weird flags to the system getaddrinfo. Make sure there is no overlap between flag values. svn:r1540
Nick Mathewson 625a261a 2009-11-17T02:40:14 OpenBSD demands that sys/types.h be included before sys/socket.h svn:r1539
Nick Mathewson 888007f9 2009-11-17T02:38:19 Windows *does* have getservbyname, no matter what autoconf says. TODO: figure out why autoconf is confused about this. svn:r1538
Nick Mathewson 86f57420 2009-11-16T22:25:46 Add two implementations of getaddrinfo: one blocking and one nonblocking. The entry points are evutil_getaddrinfo and evdns_getaddrinfo respectively. There are fairly extensive unit tests. I believe this code conforms to RFC3493 pretty closely, but there are probably more issues. It should get tested on more platforms. This code means we can dump the well-intentioned but weirdly-implemented bufferevent_evdns and evutil_resolve code. svn:r1537
Nick Mathewson 72bafc17 2009-11-16T22:23:55 Remove the stupid brokenness where DNS option names needed to end with a colon. svn:r1536
Nick Mathewson f9de8670 2009-11-16T22:23:06 Fix a declaration of __func__ in rpcgen. svn:r1535
Nick Mathewson 18a8cfac 2009-11-15T19:00:12 Prefer calloc(a,b) to malloc(a*b). via openbsd. svn:r1531
Nick Mathewson 629a6133 2009-11-15T18:59:59 When running set[ug]id, don't check the environment. Idea from OpenBSD, but made a bit more generic to handle uncivilized lands that do not define issetugid. svn:r1530
Nick Mathewson e2b2de79 2009-11-15T18:59:48 Use arc4random() for dns transaction ids where available. Patch taken from OpenBSD svn:r1528
Nick Mathewson c79a45e0 2009-11-14T21:54:30 Fix a couple of event_debug calls. svn:r1527
Nick Mathewson 74871cac 2009-11-09T19:37:27 Change event_base.activequeues to "array of eventlist". Previously, event_base.activequeues was of type "array of pointers to eventlist." This was pointless: none of the eventlists were allowed to be NULL. Worse, it was inefficient: - It made looking up an active event queue take two pointer deferences instead of one, thus risking extra cache misses. - It used more RAM than it needed to, because of the extra pointer and the malloc overhead. Also, this patch fixes a bug where we were saying calloc(N,N*sizeof(X)) instead of calloc(N,sizeof(X)) when allocating activequeues. That part, I'll backport. Also, we warn and return -1 on failure to allocate activequeues, rather than calling event_err. svn:r1525
Nick Mathewson cdf58009 2009-11-09T19:37:21 Change an OOM err to a warn in event_tagging.c svn:r1524
Nick Mathewson 26573d3d 2009-11-09T19:37:15 Change an err to a warn in bufferevent_openssl svn:r1523
Nick Mathewson 37e23f80 2009-11-09T18:50:20 Patch from Ryan Phillips: accept ipv6 addresses returned by getaddrinfo in http.c svn:r1522
Nick Mathewson b2fe4aed 2009-11-09T18:36:34 Unit tests for got_break and got_exit. svn:r1521
Nick Mathewson e88079a8 2009-11-09T18:30:57 Make persistent timeouts more accurate. Previously, if the user scheduled a persistent timeout for {1,0}, we would schedule the first one at "now+one second", and then when we were about to run its callback, we would schedule it again for one second after that. This would introduce creeping delays to the event that was supposed to run every second. Now, we schedule the event for one second after it was _last scheduled_. To do this, we introduce internal code to add an event at an _absolute_ tv rather than at now+tv. svn:r1520
Nick Mathewson 59be8942 2009-11-09T18:30:48 Make sure that common timeouts are inserted in-order. This code should be a no-op, except under strange thread contention situations. svn:r1519
Nick Mathewson ab96b5f3 2009-11-09T18:30:33 Add an option to disable the timeval cache. svn:r1518
Nick Mathewson 693c24ef 2009-11-09T17:16:30 Implement queued timeouts for case where many timeouts are the same. Libevent's current timeout code is relatively optimized for the randomly scattered timeout case, where events are added with their timeouts in no particular order. We add and remove timeouts with O(lg n) behavior. Frequently, however, an application will want to have many timeouts of the same value. For example, we might have 1000 bufferevents, each with a 2 second timeout on reading or writing. If we knew this were always the case, we could just put timeouts in a queue and get O(1) add and remove behavior. Of course, a queue would give O(n) performance for a scattered timeout pattern, so we don't want to just switch the implementation. This patch gives the user the ability to explicitly tag certain timeout values as being "very common". These timeout values have a cookie encoded in the high bits of their tv_usec field to indicate which queue they belong on. The queues themselves are each triggered by an entry in the minheap. See the regress_main.c code for an example use. svn:r1517
Nick Mathewson 784b8773 2009-11-06T21:46:57 We do not work any more without an event-config.h; stop pretending that it is meaningful to check for HAVE_CONFIG_H svn:r1516
Nick Mathewson 4d48cf61 2009-11-06T21:13:25 Fix kqueue.c build on GNU/kFreeBSD systems. Yes, some people like to have a BSD-family kernel (thus getting kqueue) with a GNU-family libc (thus occasionally mandating _GNU_SOURCE). Thanks to Debian for noticing this. svn:r1514
Nick Mathewson 5ec43fe4 2009-11-06T17:12:39 Fix a miscalculated realloc() size in win32select.c. This bug was introduced by the code to make the backend able to safely release the base lock while calling select(). Also, we change win32select.c to the same 32-fds-to-start default as the rest of the backends, so that the main/many_events test can test it. It was at 64-to-start, so the test wasn't hitting it. svn:r1513
Nick Mathewson ae5fbf49 2009-11-05T22:24:21 Actually add the new dns-example.c code. :p svn:r1512