Log

Author Commit Date CI Message
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
Nick Mathewson d2e7e65d 2009-11-05T22:19:09 Move the evdns sample code into the sample directory and fix it not to use any deprecated APIs. svn:r1511
Nick Mathewson ac633aeb 2009-11-05T21:22:23 Fix some build warnings on MSVC, mostly related to signed/unsigned comparisons. svn:r1510
Nick Mathewson 43ba6693 2009-11-05T20:45:07 Export nmakefiles in source distribution. svn:r1509
Nick Mathewson 4ca9efea 2009-11-05T20:40:11 Add nmake files to build with MSVC. Right now, they just make static libraries and unit tests. They probably set lots of options wrong. svn:r1507
Nick Mathewson 25a5e681 2009-11-05T20:37:19 Build fixes for MSVC svn:r1506
Nick Mathewson d3401928 2009-11-05T18:49:08 Rename win32.c to win32select.c, and take it out of the WIN32-Code ghetto. svn:r1504
Nick Mathewson d14c3b45 2009-11-05T18:25:46 Fix another ssize_t user svn:r1503
Nick Mathewson a0b30263 2009-11-05T18:07:27 Remove win32-code/config.h. It was apparently confusing. svn:r1502
Nick Mathewson 34f28e08 2009-11-05T15:57:22 Fix a few types to use compatible versions svn:r1501
Nick Mathewson 47bad8ab 2009-11-04T20:17:32 Implement size limits on HTTP header length and body length. Patch from Constantine Verutin, simplified a little. svn:r1500
Nick Mathewson 86db1c85 2009-11-04T05:19:26 Commit ConnectEx code to get connect working with async bufferevents. This is code by Chris Davis, with changes to get the unit tests failing less aggressively. The unit tests for this code do not completely pass yet; Chris is looking into that. If they aren't passing by the next release, I'll turn off this code. svn:r1499
Nick Mathewson 6ca32df1 2009-11-04T03:54:05 Add a missing include for win32. svn:r1498
Nick Mathewson f9c65580 2009-11-03T20:42:32 Oops; add missing bufferevent_evdns.c file svn:r1497
Nick Mathewson 0b9eb1bf 2009-11-03T20:40:48 Add a bufferevent function to resolve a name then connect to it. This function, bufferevent_socket_connect_hostname() can either use evdns to do the resolve, or use a new function (evutil_resolve) that uses getaddrinfo or gethostbyname, like http.c does now. This function is meant to eventually replace the hostname resolution mess in http.c. svn:r1496
Nick Mathewson fcc7668c 2009-11-03T20:05:06 Fix one IOCP-callback signature I missed svn:r1495
Nick Mathewson 0fd0255f 2009-11-03T19:54:56 Remove compat/sys/_time.h I've gone through everything that it declared to see where it was used, and it seems that we probably don't need it anywhere. Here's what it declared, and why I think we're okay dropping it. o struct timeval {} (Used all over, and we can't really get away with declaring it ourselves; we need the same definition the system uses. If we can't find struct timeval, we're pretty much sunk.) o struct timespec {} (Used in event.c, evdns.c, kqueue.c, evport.c. Of these, kqueue.c and event.c include sys/_time.h. event.c conditions its use on _EVENT_HAVE_CLOCK_GETTIME, and kqueue() only works if timespec is defined.) o TIMEVAL_TO_TIMESPEC (Used in kqueue.c, but every place with kqueue has sys/time.h) o struct timezone {} (event2/util.h has a forward declaration; only evutil.c references it and doesn't look at its contents.) o timerclear, timerisset, timercmp, timeradd, timersub (Everything now uses the evutil_timer* variants.) o ITIMER_REAL, ITIMER_VIRTUAL, ITIMER_PROF, struct itemerval (These are only used in test/regress.c, which does not include _time.h) o CLOCK_REALTIME (Only used in evdns.c, which does not include _time.h) o TIMESPEC_TO_TIMEVAL o DST_* o timespecclear, timespecisset, timespeccmp, timespecadd, timespecsub o struct clockinfo {} o CLOCK_VIRTUAL, CLOCK_PROF o TIMER_RELTIME, TIMER_ABSTIME (unused) svn:r1494
Nick Mathewson 0aa6f513 2009-11-02T20:59:13 Fix remaining AcceptEx issues. svn:r1492
Nick Mathewson e794d716 2009-11-02T20:20:40 Clean up acceptex code some more: add locking, single-threading, enable/disable. svn:r1491
Nick Mathewson a84c87d7 2009-11-02T19:51:26 Refactor IOCP callback interface Chris Davis points out that GetQueuedCompletionStatus sometimes returns false not to report "No events for you!" but instead to report "An overlapped operation failed." Add a way to tell an event_overlapped that its operation failed. svn:r1490
Nick Mathewson 9a772148 2009-11-02T19:31:29 Compilation and correctness fixes for IOCP listener code. svn:r1489
Nick Mathewson 8283b2f0 2009-11-02T19:30:25 Fix a major parenthesis bug in EVUTIL_UPCAST. Fortunately, this didn't hurt anything previously, since we had no actual users of the macro where the offset of the base type wasn't 0. svn:r1488
Nick Mathewson 5f1d6e64 2009-11-02T17:42:16 Add more IOCP tests. They might not pass yet. svn:r1487
Nick Mathewson 5d2c1650 2009-11-02T17:42:09 More refactoring for IOCP listener code svn:r1486
Nick Mathewson e90e14fb 2009-11-02T16:31:13 Call the bufferevent_flush_mode variable "mode" more consistently in the documentation. Spotted by Alex. svn:r1485
Nick Mathewson 7f0ad2f6 2009-11-02T16:17:06 Fix an errant user of ssize_t to use ev_ssize_t. My usual strategy of grep '[^_]ssize_t' had apparently failed me, since this ssize_t was in the first column. Resolves bug 2890434; spotted by Mihai Draghicioiu. svn:r1484
Nick Mathewson 315fde1a 2009-10-30T22:43:53 Remove some duplicate code in kqueue.c and fix a small memory leak. svn:r1483
Nick Mathewson 96c6956e 2009-10-30T22:43:30 Add a "many events" regression test. This is a glass-box test to get more coverage on the event loop backends. We've run into bugs here before with fencepost errors, and it turns out that none of our unit tests had enough events to exercise the resize code. Most of the backends have some kind of logic that resizes an array when: - The highest fd is too high - The number of events added since the last iteration of the loop is too high - The number of active events is too high. This test hits all 3 cases, and increases coverage in select.c by 7%, in poll by 1%, and in kqueue by 9%. svn:r1482
Nick Mathewson 516452b7 2009-10-30T21:08:29 Keep openssl errors associated with the right bufferevent object. OpenSSL has a per-thread error stack, and really doesn't like you leaving errors on the stack. Rather than discard the errors or force the user to handle them, this patch pulls them off the openssl stack and puts them on a stack associated with the bufferevent_openssl. If the user leaves them on the stack then, it won't affect any other connections. This bug was found by Roman Puls. Thanks! svn:r1481
Nick Mathewson 20f5bdfd 2009-10-29T19:25:33 Refactor evconnlistener to allow multiple implementations; add an (incomplete, not-yet-integrated) IOCP implementation. svn:r1480
Nick Mathewson fa313f28 2009-10-29T18:30:43 Extract XP-only functions when initializing the IOCP port svn:r1479
Nick Mathewson 9976f1e7 2009-10-29T17:11:12 reformat weird indentation in dns tests svn:r1478
Nick Mathewson 3c2198cb 2009-10-29T17:10:36 Unit test for reverse ipv6 lookup svn:r1477
Nick Mathewson 5b3fb5bf 2009-10-29T16:35:20 More documentation and unit tests for event_tagging. svn:r1476
Nick Mathewson 1eadb3e3 2009-10-29T16:35:15 Actually use the logic in select.c designed to make the out_sets threadsafe. svn:r1475
Nick Mathewson c70c2593 2009-10-29T16:35:09 Unit test for strlcpy svn:r1474
Nick Mathewson e9098203 2009-10-27T18:25:19 Fix from Chris Davis: get error-logging to be happy on win32. svn:r1473
Nick Mathewson 904b5721 2009-10-27T06:47:25 Avoid calling exit() during event_base_new*() Previously, each of the three make-an-event-base functions would exit under different, weird circumstances, but return NULL on others. - All three would exit on OOM sometimes. - event_base_new() and event_init() would die if all backends were disabled. - None of them would die if the socketpair() call failed. Now, only event_init() exits on failure, and it exits on every kind of failure. event_base_new() and event_base_new_with_config() never do. svn:r1472
Nick Mathewson a2a7d1d1 2009-10-27T05:16:32 Do not call the locking variant of event_add or event_active in some cases when we know we have the lock. svn:r1471
Nick Mathewson d386dc89 2009-10-27T05:16:23 Refactor event_assing even more to avoid unnecessary calls svn:r1470
Nick Mathewson e9ee1057 2009-10-27T04:25:45 Give event_assign a return value, and make it less inclined to exit(). We also refactor event_assign so that it is the core function, and event_set() is only the wrapper. svn:r1469
Nick Mathewson 10cf631e 2009-10-27T04:04:07 Do not add a newline to the end of log statements. svn:r1468
Nick Mathewson 369aafc4 2009-10-27T04:03:58 Refactor kq_init error handling. svn:r1467
Nick Mathewson ed0e91e0 2009-10-27T04:03:50 New test flag to suppress logging for one test. svn:r1466
Nick Mathewson 7f10fac3 2009-10-26T20:07:06 Note assert-related change in changelog svn:r1465
Nick Mathewson 2e36dbe1 2009-10-26T20:00:43 Use EVUTIL_ASSERT() consistently instead of assert. svn:r1464
Nick Mathewson 37c3456d 2009-10-26T20:00:08 Add an EVUTIL_ASSERT() to replace our calls to assert(). The big difference here is that EVUTIL_ASSERT() passes its message on via event_errx() before aborting, so that the application has a prayer of noticing and recording it. svn:r1463
Nick Mathewson a8267663 2009-10-26T19:59:51 API to replace all calls to exit() with a user-supplied fatal-error handler. Also, add unit tests for logging. svn:r1462
Nick Mathewson 38aec9ec 2009-10-23T22:38:35 Tweaks to IOCP interface. svn:r1461
Nick Mathewson 7b107249 2009-10-23T22:07:05 Fix my fix for the bufferevent_connect_fail() test. svn:r1460
Nick Mathewson 879420a7 2009-10-23T22:00:29 Expose a narrow window to the IOCP code. svn:r1459
Nick Mathewson c119e4a1 2009-10-23T17:40:00 Improve the behavior of le-proxy in a few cases. svn:r1458
Nick Mathewson fdd11c00 2009-10-21T19:21:05 Make the bufferevent_connect_fail test faster on OSX. It seems that connecting to a listener that is bound but not accepting or listening doesn't give a 'connection refused' error on OSX, but rather makes the connect() time out after 75 seconds. I couldn't find any way to make the timout shorter. Fortunately, closing the listener after a second or so makes the desired error occur after another second or so. svn:r1457
Nick Mathewson b73ad7bc 2009-10-21T18:48:22 Treat the bitwise OR of two enum values as an int. This makes our interfaces usable from C++, which doesn't believe you can say "bufferevent_socket_nase(base, -1, BEV_OPT_CLOSE_ON_FREE|BEV_OPT_DEFER_CALLBACKS)" but which instead would demand "static_cast<bufferevent_options>(BEV_OPT_CLOSE_ON_FREE| BEV_OPT_DEFER_CALLBACKS))" for the last argument. Diagnosis and patch from Chris Davis. svn:r1456