12dedff36SNick MathewsonChanges in version 2.1.1-alpha (4 Apr 2012) 225a424fbSNick Mathewson 32dedff36SNick Mathewson Libevent 2.1.1-alpha includes a number of new features and performance 42dedff36SNick Mathewson improvements. The log below tries to organize them by rough area of 52dedff36SNick Mathewson effect. It omits some commits which were pure bugfixes on other commits 62dedff36SNick Mathewson listed below. For more detail, see the git changelogs. For more 72dedff36SNick Mathewson insight, see the "whatsnew-2.1.txt" document included in the Libevent 82dedff36SNick Mathewson 2.1.1-alpha distribution. 925a424fbSNick Mathewson 102dedff36SNick Mathewson Performance: Core 112dedff36SNick Mathewson o Replace several TAILQ users with LIST. LIST can be a little faster than 122dedff36SNick Mathewson TAILQ for cases where we don't need queue-like behavior. (f9db33d, 132dedff36SNick Mathewson 6494772, d313c29, 974d004) 142dedff36SNick Mathewson o Disabled code to optimize the case where we reinsert an existing 152dedff36SNick Mathewson timeout (e47042f, 09cbc3d) 162dedff36SNick Mathewson o Remove a needless base-notify when rescheduling the first timeout (77a96fd) 172dedff36SNick Mathewson o Save a needless comparison when removing/adjusting timeouts (dd5189b) 182dedff36SNick Mathewson o Possible optimization: split event_queue_insert/remove into 192dedff36SNick Mathewson separate functions. needs testing (efc4dc5) 20*88b4f0bbSNick Mathewson o Make event_count maintenance branchless at the expense of an 212dedff36SNick Mathewson extra shift. Needs benchmarking (d1cee3b) 222dedff36SNick Mathewson o In the 2.1 branch, let's try out lazy gettimeofday/clock_gettime 232dedff36SNick Mathewson comparison (2a83ecc) 242dedff36SNick Mathewson o Optimization in event_process_active(): ignore maxcb & endtime 252dedff36SNick Mathewson for highest priority events. (a9866aa Alexander Drozdov) 262dedff36SNick Mathewson o Bypass event_add when using event_base_once() for a 0-sec timeout (35c5c95) 272dedff36SNick Mathewson o Remove the eventqueue list and the ev_next pointers. (604569b 066775e) 2877342926SNick Mathewson 292dedff36SNick Mathewson Performance: Evbuffers 302dedff36SNick Mathewson o Roughly 20% speed increase when line-draining a buffer using 312dedff36SNick Mathewson EVBUFFER_EOL_CRLF (5dde0f0 Mina Naguib) 322dedff36SNick Mathewson o Try to squeeze a little more speed out of EVBUFFER_EOL_CRLF (7b9d139) 332dedff36SNick Mathewson o Fix a bug in the improved EOL_CRLF code (d927965) 342dedff36SNick Mathewson o Remove a needless branch in evbuffer_drain() (d19a326) 3577342926SNick Mathewson 362dedff36SNick Mathewson Performance: Linux 372dedff36SNick Mathewson o Infrastructure for using faster/fewer syscalls when creating 382dedff36SNick Mathewson sockets (a1c042b) 392dedff36SNick Mathewson o Minimize syscalls during socket creation in listener.c (7e9e289) 402dedff36SNick Mathewson o Use a wrapper function to create the notification 412dedff36SNick Mathewson pipe/socketpair/eventfd (ca76cd9) 422dedff36SNick Mathewson o Use pipes for telling signals to main thread when possible (a35f396) 432dedff36SNick Mathewson o Save syscalls when constructing listener sockets for evhttp (af6c9d8) 442dedff36SNick Mathewson o Save some syscalls when creating evdns sockets (713e570) 452dedff36SNick Mathewson o Save some syscalls when constructing a socket for a bufferevent (33fca62) 462dedff36SNick Mathewson o Prefer epoll_create1 on Linuxen that have it (bac906c) 4777342926SNick Mathewson 482dedff36SNick Mathewson Performance: Epoll backend 492dedff36SNick Mathewson o Use current event set rather than current pending change when 502dedff36SNick Mathewson deciding whether to no-op a del (04ba27e Mike Smellie) 512dedff36SNick Mathewson o Replace big chain of if/thens in epoll.c with a table lookup (8c83eb6) 522dedff36SNick Mathewson o Clean up error handling in epoll_apply_one_change() a little (2d55a19) 5377342926SNick Mathewson 542dedff36SNick Mathewson Performance: Evport backend 552dedff36SNick Mathewson o evport: use evmap_io to track fdinfo status. Should save time and 562dedff36SNick Mathewson RAM. (4687ce4) 572dedff36SNick Mathewson o evport: Remove a linear search over recent events when 582dedff36SNick Mathewson reactivating them (0f77efe) 592dedff36SNick Mathewson o evport: Use portev_user to remember fdinfo struct (276ec0e) 602dedff36SNick Mathewson o evport: don't scan more events in ed_pending than needed (849a5cf) 612dedff36SNick Mathewson o evport: Remove artificial low limit on max events per getn call (c04d927) 622dedff36SNick Mathewson o Reenable main/many_events_slow_add for evport in 2.1 (e903db3) 630c483170SNick Mathewson 642dedff36SNick Mathewson Performance: Windows 652dedff36SNick Mathewson o Use GetSystemTimeAsFileTime to implement gettimeofday on 662dedff36SNick Mathewson win32. It's faster and more accurate than our old 672dedff36SNick Mathewson approach. (b8b8aa5) 68edc6d7d7SNick Mathewson 692dedff36SNick Mathewson New functions and features: debugging 702dedff36SNick Mathewson o Add event_enable_debug_logging() to control use of debug logs (e30a82f) 71edc6d7d7SNick Mathewson 722dedff36SNick Mathewson New functions and features: core 732dedff36SNick Mathewson o Add event_config function to limit time/callbacks between calls 742dedff36SNick Mathewson to dispatch (fd4de1e, 9fa56bd, a37a0c0, 3c63edd) 752dedff36SNick Mathewson o New EVLOOP_NO_EXIT_ON_EMPTY option to keep looping even when no 762dedff36SNick Mathewson events are pending (084e68f) 772dedff36SNick Mathewson o Add event_base_get_npriorities() function. (ee3a4ee Alexander Drozdov) 782dedff36SNick Mathewson o Make evbase_priority_init() and evbase_get_npriorities() 792dedff36SNick Mathewson threadsafe (3c55b5e) 802dedff36SNick Mathewson o New event_base_update_cache_time() to set cached_tv to current 812dedff36SNick Mathewson time (212533e Abel Mathew) 822dedff36SNick Mathewson o Add event_self_cbarg() to be used in conjunction with 832dedff36SNick Mathewson event_new(). (ed36e6a Ross Lagerwall, fa931bb, 09a1906, 1338e6c, 842dedff36SNick Mathewson 33e43ef) 852dedff36SNick Mathewson o Add a new libevent_global_shutdown() to free all globals before 862dedff36SNick Mathewson exiting. (041ca00 Mark Ellzey, f98c158, 15296d0, 55e991b) 872dedff36SNick Mathewson o Use getifaddrs to detect our interfaces if possible (7085a45) 882dedff36SNick Mathewson o Add event_base_get_running_event() to get the event* whose cb we 892dedff36SNick Mathewson are in (c5732fd, 13dad99) 90edc6d7d7SNick Mathewson 912dedff36SNick Mathewson New functions and features: building 922dedff36SNick Mathewson o Implement --enable-gcc-hardening configure option (7550267 Sebastian Hahn) 93edc6d7d7SNick Mathewson 942dedff36SNick Mathewson New functions and features: evbuffers 952dedff36SNick Mathewson o Add evbuffer_add_file_segment() so one fd can be used efficiently 962dedff36SNick Mathewson in more than one evbuffer_add_file at a time (e72afae, c2d9884, 972dedff36SNick Mathewson 3f405d2, 0aad014) 982dedff36SNick Mathewson o Fix windows file segment mappings (8254de7) 992dedff36SNick Mathewson o Allow evbuffer_ptr_set to yield a point just after the end of the 1002dedff36SNick Mathewson buffer. (e6fe1da) 1012dedff36SNick Mathewson o Allow evbuffer_ptr to point to position 0 in an empty evbuffer 1022dedff36SNick Mathewson (7aeb2fd Nir Soffer) 103*88b4f0bbSNick Mathewson o Set the special "not found" evbuffer_ptr consistently. (e3e97ae Nir Soffer) 1042dedff36SNick Mathewson o support adding buffers to other buffers non-destructively 1052dedff36SNick Mathewson (9d7368a Joachim Bauch) 1062dedff36SNick Mathewson o prevent nested multicast references, reworked locking (26041a8 1072dedff36SNick Mathewson Joachim Bauch) 1082dedff36SNick Mathewson o New EVBUFFER_EOL_NUL to read NUL-terminated strings from an 1092dedff36SNick Mathewson evbuffer (d7a8b36 Andrea Montefusco, 54142c9) 1102dedff36SNick Mathewson o Make evbuffer_file_segment_types adaptable (c6bbbf1) 1112dedff36SNick Mathewson o Added evbuffer_add_iovec and unit tests. (aaec5ac Mark Ellzey, 27b5398) 1122dedff36SNick Mathewson o Add evbuffer_copyout_from to copy data from the middle of a 1132dedff36SNick Mathewson buffer (27e2225) 1146f6cebe3SNick Mathewson 1152dedff36SNick Mathewson New functions and features: bufferevents 1162dedff36SNick Mathewson o Allow users to set allow_dirty_shutdown (099d27d Catalin Patulea) 1172dedff36SNick Mathewson o Tweak allow_dirty_shutdown documentation (a44cd2b) 1182dedff36SNick Mathewson o Fix two issues in the allow_dirty_shutdown code. (f3b89de) 1192dedff36SNick Mathewson o Add a bufferevent_getcb() to find a bufferevent's current 1202dedff36SNick Mathewson callbacks (a650394) 1212dedff36SNick Mathewson o bufferevent: Add functions to set/get max_single_read/write 1222dedff36SNick Mathewson values. (998c813 Alexander Drozdov) 1232dedff36SNick Mathewson o bev_ssl: Be more specific in event callbacks. evhttp in particular gets 1242dedff36SNick Mathewson confused without at least one of BEV_EVENT_{READING|WRITING}. (f7eb69a 1252dedff36SNick Mathewson Catalin Patulea) 126edc6d7d7SNick Mathewson 1272dedff36SNick Mathewson New functions and features: evconnlisteners 1282dedff36SNick Mathewson o Support TCP_DEFER_ACCEPT sockopts for listeners (5880e4a Mark Ellzey, 1292dedff36SNick Mathewson a270728) 1302dedff36SNick Mathewson o Add another caveat to the TCP_DEFER_ACCEPT documentation (a270728) 1312dedff36SNick Mathewson o Allow evconnlistener to be created in disabled state. (9593a33 1322dedff36SNick Mathewson Alexander Drozdov) 1332dedff36SNick Mathewson o The LEV_OPT_CLOSE_ON_EXEC flag now applies to accepted listener 1342dedff36SNick Mathewson sockets too (4970329) 135edc6d7d7SNick Mathewson 1362dedff36SNick Mathewson Evhttp: 1372dedff36SNick Mathewson o Add new evhttp_{connection_}set_timeout_tv() functions to set 1382dedff36SNick Mathewson finger-grained http timeouts (6350e6c Constantine Verutin) 1392dedff36SNick Mathewson o Performance tweak to evhttp_parse_request_line. (aee1a97 Mark Ellzey) 1402dedff36SNick Mathewson o Add missing break to evhttp_parse_request_line (0fcc536) 1412dedff36SNick Mathewson o Add evhttp callback for bufferevent creation; this lets evhttp 1422dedff36SNick Mathewson support SSL. (8d3a850) 1432dedff36SNick Mathewson o Remove calls to deprecated bufferevent functions from evhttp.c (4d63758) 1442dedff36SNick Mathewson o evhttp: Add evhttp_foreach_bound_socket. (a2c48e3 Samy Al Bahra) 145edc6d7d7SNick Mathewson 1462dedff36SNick Mathewson Build improvements: 1472dedff36SNick Mathewson o Add AC_USE_SYSTEM_EXTENSIONS to configure.in. Requires follow on 1482dedff36SNick Mathewson patches for correctness and robustness. (1fa7dbe Kevin Bowling) 1492dedff36SNick Mathewson o Filter '# define' statements from autoconf and generate 1502dedff36SNick Mathewson event-private.h (321b558 Kevin Bowling) 1512dedff36SNick Mathewson o Remove internal usage of _GNU_SOURCE (3b26541 Kevin Bowling) 1522dedff36SNick Mathewson o Eliminate a couple more manual internal _GNU_SOURCE defines (c51ef93 1532dedff36SNick Mathewson Kevin Bowling) 1542dedff36SNick Mathewson o Add AC_GNU_SOURCE to the fallback case. (ea8fa4c Kevin Bowling) 1552dedff36SNick Mathewson o Use a Configuration Header Template for evconfig-private.h (868f888 1562dedff36SNick Mathewson Kevin Bowling) 1572dedff36SNick Mathewson o Fix a comment warning and add evconfig-private.h to .gitignore 1582dedff36SNick Mathewson (f6d66bc Kevin Bowling) 1592dedff36SNick Mathewson o Include evconfig-private.h in internal files for great good. (0915ca0 1602dedff36SNick Mathewson Kevin Bowling) 1612dedff36SNick Mathewson o Backport libevent to vanilla Autoconf 2.59 (as used in RHEL5) 1622dedff36SNick Mathewson (ad03952 Kevin Bowling) 1632dedff36SNick Mathewson o Prefer the ./configure evconfig-private.h in MinGW, just in 1642dedff36SNick Mathewson case. (f964b72 Kevin Bowling) 1652dedff36SNick Mathewson o Shell hack for weird mkdir -p commands (fd7b5a8 Kevin Bowling) 1662dedff36SNick Mathewson o Add evconfig-private to remaining files (ded0a09 Kevin Bowling) 1672dedff36SNick Mathewson o Allow use of --enable-silent-rules for quieter compilation with 1682dedff36SNick Mathewson automake 1.11 (f1f8514 Dave Hart) 1692dedff36SNick Mathewson o Use "_WIN32", not WIN32: it's standard and we don't need to fake it 1702dedff36SNick Mathewson (9f560b) 1712dedff36SNick Mathewson o In configure, test for _WIN32 not WIN32. (85078b1 Peter Rosin) 1722dedff36SNick Mathewson o Do not define WIN32 in Makefile.nmake (d41f3ea Peter Rosin) 1732dedff36SNick Mathewson o Provide the autoconf m4 macros for the new OpenSSL via pkg-config 1742dedff36SNick Mathewson stuff. (674dc3d Harlan Stenn) 1752dedff36SNick Mathewson o Use pkg-config (if available) to handle OpenSSL. (1c63860 Harlan Stenn) 1762dedff36SNick Mathewson o We need AM_CPPFLAGS when compiling bufferevent_openssl.c (6d2613b 1772dedff36SNick Mathewson Harlan Stenn) 1782dedff36SNick Mathewson o Fix OSX build: $(OPENSSL_INCS) needs to be after 1792dedff36SNick Mathewson $(AM_CPPFLAGS). (46f1769 Zack Weinberg) 1802dedff36SNick Mathewson o Make gcc warnings on by default, and --enable-gcc-warnings only add 1812dedff36SNick Mathewson -Werror (d46517e Sebastian Hahn) 1822dedff36SNick Mathewson o Split up extra-long AC_CHECK_FUNCS/HEADERS lines in configure.in (88a30ad) 1832dedff36SNick Mathewson o Move libevent 1.x headers to include/, to put all public headers in 1842dedff36SNick Mathewson one place. (bbea8d6) 1852dedff36SNick Mathewson o Put #ifdef around some files to support alternate build 1862dedff36SNick Mathewson systems. (76d4c92 Ross Lagerwall) 1872dedff36SNick Mathewson o Also make win32select.c conditional for IDE users (bf2c5a7) 188edc6d7d7SNick Mathewson 1892dedff36SNick Mathewson Debugging: 1902dedff36SNick Mathewson o Add a magic number to debug_locks to better catch lock-coding 1912dedff36SNick Mathewson errors. (b4a29c0 Dave Hart) 1922dedff36SNick Mathewson o munge the debug_lock signature before freeing it: it might help us 1932dedff36SNick Mathewson catch use-after-free (f28084d) 1942dedff36SNick Mathewson o Added --enable-event-debugging in configure (bc7b4e4, a9c2c9a Mark Ellzey) 1952dedff36SNick Mathewson o Debug addition for printing usec on TIMEOUT debugging. (ac43ce0 Mark Ellzey) 1962dedff36SNick Mathewson o Added usec debug in another area for debug (3baab0d Mark Ellzey) 1972dedff36SNick Mathewson o added timeout debug logs to include event ptr. (4b7d298 Mark Ellzey) 1982dedff36SNick Mathewson o more event dbg updates (6727543 Mark Ellzey) 1992dedff36SNick Mathewson o Clarify event_enable_debug_logging a little (6207826) 2002dedff36SNick Mathewson o Make --enable-verbose-debug option match its help text (10c3450) 2012dedff36SNick Mathewson o Add argument checks to some memory functions in `event.c'. (c8953d1 2022dedff36SNick Mathewson Mansour Moufid) 20334045c8fSNick Mathewson 2042dedff36SNick Mathewson Testing: 2052dedff36SNick Mathewson o More abstraction in test.sh (cd74c4e) 2062dedff36SNick Mathewson o Add failing test for evbuffer_search_range. (8e26154 Nir Soffer) 2072dedff36SNick Mathewson o Tweaks to return types with end-of-buf ptrs (9ab8ab8) 2082dedff36SNick Mathewson o Add an (internal) usleep function for use by unit tests (f25d9d3) 2092dedff36SNick Mathewson o Synchronize with upstream tinytest (6c81be7) 2102dedff36SNick Mathewson o Make test-changelist faster (7622d26) 2112dedff36SNick Mathewson o Reduce the timeout in the main/fork test. (ab14f7c) 2122dedff36SNick Mathewson o New evhttp function to adjust initial retry timeout (350a3c4) 2132dedff36SNick Mathewson o Make regression tests run over 3x faster. (67a1763) 2142dedff36SNick Mathewson o Use test_timeval_diff_eq more consistently (b77b43f) 2152dedff36SNick Mathewson o Allow more slop in deferred_cb_skew test; freebsd needs it (b9f7e5f) 2162dedff36SNick Mathewson o When including an -internal.h header outside the main tree, do so 2172dedff36SNick Mathewson early (95e2455) 2182dedff36SNick Mathewson o Add a new test: test-fdleak which tests for fd leaks by creating many 2192dedff36SNick Mathewson sockets. (2ef9278 Ross Lagerwall, f7af194, 1c4288f, etc) 2202dedff36SNick Mathewson o Add a unit test for event_base_dump_events() (7afe48a, 8d08cce) 2212dedff36SNick Mathewson o Test more bufferevent_ratelim features (c24f91a) 22234045c8fSNick Mathewson 2232dedff36SNick Mathewson Documentation: 2242dedff36SNick Mathewson o Improve evbuffer_ptr documentation (261ba63) 225*88b4f0bbSNick Mathewson o added comments to describe refcounting of multicast chains (ba24f61 2262dedff36SNick Mathewson Joachim Bauch) 2272dedff36SNick Mathewson o Add doxygen for event_base_dump_events (cad5753) 22831c99bd2SNick Mathewson 2292dedff36SNick Mathewson OSX: 2302dedff36SNick Mathewson o Use "unlimited select" on OSX so that we can have more than 2312dedff36SNick Mathewson FD_SETSIZE fds (1fb5cc6) 23234045c8fSNick Mathewson 2332dedff36SNick Mathewson KQueue: 2342dedff36SNick Mathewson o Use SIG_IGN instead of a do-nothing handler for signal events with 2352dedff36SNick Mathewson kqueue (148458e Zack Weinberg) 23634045c8fSNick Mathewson 2372dedff36SNick Mathewson evprc: 2382dedff36SNick Mathewson o event_rpcgen.py now prints status information to stdout and errors to 2392dedff36SNick Mathewson stderr. (ffb0ba0 Ross Lagerwall) 24034045c8fSNick Mathewson 2412dedff36SNick Mathewson Code improvement and refactoring: 2422dedff36SNick Mathewson o Make event_reinit() more robust and maintainable (272033e) 2432dedff36SNick Mathewson o Restore fast-path event_reinit() for slower backends (2c4b5de) 2442dedff36SNick Mathewson o Check changelist as part of checking representational integrity (39b3f38) 2452dedff36SNick Mathewson o Fix a compile warning in event_reinit (e4a56ed Sebastian Hahn) 2462dedff36SNick Mathewson o Refactor the functions that run over every event. (c89b4e6) 2472dedff36SNick Mathewson o Remove the last vestiges of _EVENT_USE_EVENTLIST (a3cec90) 2482dedff36SNick Mathewson o Make event-config.h depend on Makefile.am (2958a5c) 24934045c8fSNick Mathewson 2502dedff36SNick Mathewson Build fixes: 2512dedff36SNick Mathewson o Don't do clang version detection when disabling some flags (083296b 2522dedff36SNick Mathewson Sebastian Hahn) 25334045c8fSNick Mathewson 2542dedff36SNick Mathewson C standards conformance: 2552dedff36SNick Mathewson o Check for NULL return on win32 mm_calloc, and set ENOMEM. (af7ba69) 2562dedff36SNick Mathewson o Convert event-config.h macros to avoid reserved identifiers (68120d9) 2572dedff36SNick Mathewson o Generate event-config.h using the correct macros. (f82c57e) 2582dedff36SNick Mathewson o Convert include-guard macro convention to avoid reserved identifiers 2592dedff36SNick Mathewson (3f8c7cd) 260*88b4f0bbSNick Mathewson o Make event_rpcgen.py output conform to identifier conventions (372bff1) 2612dedff36SNick Mathewson o Stop referring to an obsolete include guard in bench_http.h (5c0f7e0) 2622dedff36SNick Mathewson o Make the generated event-config.h use correct include guards (639383a) 2632dedff36SNick Mathewson o Fix all identifiers with names beginning with underscore. (cb9da0b) 264*88b4f0bbSNick Mathewson o Make event_rpcgen.py output conform to identifier conventions, more 2652dedff36SNick Mathewson (bcefd24) 2662dedff36SNick Mathewson o Fix some problems introduced by automated identifier cleanup script 2672dedff36SNick Mathewson (c963534) 2682dedff36SNick Mathewson o Have all visible internal function names end with an underscore. (8ac3c4c) 2692dedff36SNick Mathewson o Apply the naming convention to our EVUTIL_IS* functions (c7848fa) 2702dedff36SNick Mathewson o Clean up lingering _identifiers. (946b584) 2712dedff36SNick Mathewson o Fix doxygen to use new macro conventions (da455e9) 2727c3e0612SNick Mathewson 2732dedff36SNick Mathewson Bugfixes: 2742dedff36SNick Mathewson o Do not use system EAI/AI values if we are not using the system 2752dedff36SNick Mathewson getaddrinfo. (7bcac07) 2767c3e0612SNick Mathewson 2772dedff36SNick Mathewson Sample Code: 2782dedff36SNick Mathewson o Fix up sample/event-test.c to use newer interfaces and make it 2792dedff36SNick Mathewson actually work. (19bab4f Ross Lagerwall) 2802dedff36SNick Mathewson o On Unix, remove event.fifo left by sample/event-test.c. (c0dacd2 Ross 2812dedff36SNick Mathewson Lagerwall) 2822dedff36SNick Mathewson o Rename event-test.c to event-read-fifo.c. (a5b370a Ross Lagerwall) 2832dedff36SNick Mathewson o event-read-fifo: Use EV_PERSIST appropriately (24dab0b) 28415be0493SNick Mathewson 2851aa6826fSNiels Provos 286