1709 Commits

Author SHA1 Message Date
Nick Mathewson
fe008ed656 Make all versioning changes for 2.0.7-rc, and add ChangeLog release-2.0.7-rc 2010-09-09 14:59:27 -04:00
Christopher Davis
d98511c027 Make event_base_virtual_del() notify the base if needed 2010-09-09 14:37:44 -04:00
Nick Mathewson
2756a10cd9 Add a missing time.h include to test/regress_thread.c 2010-09-09 13:43:31 -04:00
Nick Mathewson
fb36f9a7e5 Fix an uninitialized-variable warning on windows 2010-09-09 13:00:54 -04:00
Christopher Davis
71b6801421 Don't decrement virutal event count twice in connect_complete. 2010-09-08 20:33:21 -07:00
Christopher Davis
3ec65d6984 Fix a few Windows compile warnings. 2010-09-08 19:55:13 -07:00
Nick Mathewson
25b6a74be6 Merge branch 'tests' 2010-09-08 14:53:57 -04:00
Nick Mathewson
6f82171013 Merge remote branch 'github/win_notify' 2010-09-08 14:52:37 -04:00
Nick Mathewson
de412948a1 Add a missing header for regress_thread.c 2010-09-08 14:52:24 -04:00
Nick Mathewson
e7dc501ee5 Implement EVBASE_NEED_NOTIFY on win32 2010-09-08 14:46:47 -04:00
Sebastian Hahn
911e0db8f0 Fix a compile warning in regress_thread.c 2010-09-08 20:29:39 +02:00
Nick Mathewson
3658b1696d Merge remote branch 'chrisd/iocp-fixes4'
Conflicts:
	test/regress_thread.c
2010-09-08 14:12:12 -04:00
Nick Mathewson
9580e282d7 Merge branch 'th_notify_fd_reinit' 2010-09-08 14:00:45 -04:00
Nick Mathewson
ce85280beb Improve testing of when thread-notification occurs 2010-09-08 13:29:06 -04:00
Nick Mathewson
4632b78e01 Minimize calls to base_notify implementation functions, thereby avoiding needless syscalls
The trick here is that if we already told the base to wake up, and it
hasn't woken up yet, we don't need to tell it to wake up again.  This
should help lots with inherently multithreaded code like IOCP.
2010-09-08 13:22:55 -04:00
Nick Mathewson
c7a06bfaee Avoid needlessly calling evthread_notify_base() when the loop is not running
Also make sure that we always hold the base lock when calling evthread_notify_base.
2010-09-08 13:09:40 -04:00
Nick Mathewson
57d3413c55 Merge remote branch 'github/globals' 2010-09-08 11:39:24 -04:00
Christopher Davis
17a14f1af2 Only process up to MAX_DEFERRED deferred_cbs at a time.
If threads queue callbacks while event_process_deferred_callbacks is
running, the loop may spin long enough to significantly skew timers.
A unit test stressing this behavior is also in this commit.
2010-09-08 01:22:22 -07:00
Christopher Davis
2447fe8886 Add event_config_set_num_cpus_hint for tuning thread pools, etc. 2010-09-08 01:22:22 -07:00
Christopher Davis
499452f4c2 IOCP-related unit test tweaks 2010-09-08 01:22:22 -07:00
Christopher Davis
76f7e7ae74 Some IOCP bufferevent tweaks.
- Increment reference count of bufferevents before initiating overlapped
  operations to prevent the destructor from being called while operations
  are pending. The only portable way of canceling overlapped ops is to
  close the socket.

- Translate error codes to WSA* codes.

- Better handling of errors.

- Add an interface to add and del "virtual" events. Because IOCP
  bufferevents don't register any events with the base, the event loop
  has no way of knowing they exist. This causes the loop to terminate
  prematurely. event_base_{add,del}_virtual increment/decrement base's
  event count so the loop runs while there are any enabled IOCP
  bufferevents.
2010-09-08 01:22:22 -07:00
Christopher Davis
d844242f9b Stop IOCP when freeing the event_base. 2010-09-08 01:22:21 -07:00
Christopher Davis
03afa209de IOCP-related evbuffer fixes.
- Prevent evbuffer_{add,prepend}_buffer from moving read-pinned chains.
- Fix evbuffer_drain to handle read-pinned chains better.
- Raise the limit on WSABUFs from two to MAX_WSABUFS for overlapped reads.
2010-09-08 01:22:21 -07:00
Nick Mathewson
1115366e95 Fix a few memory leaks in the tests 2010-09-07 10:36:19 -04:00
Nick Mathewson
42090072c1 Move the "function to getsockname() on a listener" to regress_testutils
This reverts commit fab50488fcb741884ccdfa7b83643eac3e5c9cbf.

The function was, on reflection, not important enough to break the feature
freeze, since it's trivial to build on your own.
2010-09-06 15:52:48 -04:00
Nick Mathewson
c51826ff50 Merge remote branch 'github/sysqueue_include_order' 2010-09-06 15:40:13 -04:00
Shuo Chen
b0f284cb18 Fix event_del(0) instance in bench.c 2010-09-06 10:10:17 -04:00
Nick Mathewson
749128b2cf Merge remote branch 'github/win32_posix_underscore' 2010-09-04 22:02:32 -04:00
Nick Mathewson
150599e6e2 Merge remote branch 'github/cdecl' 2010-09-04 22:00:38 -04:00
Nick Mathewson
b5dd8064fc Fix uninitialized port var in http_delete_test. Last one, I hope. 2010-09-03 22:00:25 -04:00
Nick Mathewson
3b3fb7438d Fix uninitialized variables in http_bad_request_test. (oops) 2010-09-03 21:03:25 -04:00
Nick Mathewson
a97320ac57 Allow more than one copy of regression tests to run at once
Mostly this was a matter of just removing all the hardwired ports in
the test code.  The http/connection_retry test is still a little
screwy, though.
2010-09-03 18:48:31 -04:00
Nick Mathewson
195214360c Expose a function to add a nameserver by sockaddr 2010-09-03 16:42:16 -04:00
Nick Mathewson
fab50488fc Expose a function to getsockname() on a listener's fd. 2010-09-03 16:41:16 -04:00
Nick Mathewson
7ea8e89d5c Prefer autoreconf -ivf to manual autogen.sh
Suggested by Ralph Castain
2010-09-03 15:12:35 -04:00
Nick Mathewson
478827739c Fix pointer-to-__cdecl-function syntax 2010-09-02 13:21:17 -04:00
Nick Mathewson
e50c0fcc85 Use the _func() replacements for open, fstat, etc in evutil.c on win32
Remember that in a fit of ANSI C compliance, Microsoft decided to
screw portability by renaming basically all the functions in unistd.h to
get prefixed with an understore.

For some reason, mingw didn't seem to mind, but at least some people's
compilers did: see bug 3044490.
2010-09-02 13:13:28 -04:00
Nick Mathewson
f0056d041b Declare signal handler function as "__cdecl" on Windows.
I swear, they must have half a dozen different calling conventions.

(goes to check)

Holy crud.  They actually do.  There's __cdecl, __stdcall, __fastcall,
"thiscall", "naked" and the obsolete "__pascal", "__fortran", and
"__syscall".  And don't forget WINAPI and __far.

Anyways, this should fix 3044488 if I got it right.
2010-09-02 12:06:58 -04:00
Nick Mathewson
ca9048f12c Move evkeyvalq into a separate header for evhttp_parse_query users
The evhttp_parse_query API is a bit misdesigned; all the other
evkeyvalq stuff is abstract and lets you get away with having a header
stub, but evhttp_parse_query seems to require that you instantiate an
empty evkeyvalq of your own.
2010-09-02 11:36:44 -04:00
Nick Mathewson
d3ceca800e Declare evkeyvalq and event_list even if event_struct.h comes before sys/queue.h
Fixes bug 3036645 reported by Mihai Draghicioiu
2010-09-02 11:27:57 -04:00
Nick Mathewson
495ed66705 Close th_notify_fds and open a new pair on reinit
After a fork, you want subthreads to wake up the event_base in the
child process, not to have the child process and the main process
fight over who wakes up whom.

Related to a problem found by Nicholas Marriott while debugging
3048812.
2010-09-02 11:00:27 -04:00
Nick Mathewson
5de2bcb70f On windows, make lock/thread function tables static
This requires us to have a separate implementation of the lock macros
that indirects to a set of functions.  Fortunately, this isn't too
hard to do.

This may be a fix for bug 3042969, where our openssl dll and our
libevent dll each got their own version of the thread stuff.
2010-09-01 16:03:39 -04:00
Nick Mathewson
5218d2a8b1 Make defer-internal.h use lock macros, not direct cess to lock fns 2010-09-01 15:56:22 -04:00
Nick Mathewson
1fdec20f8f Stop using global arrays to implement the EVUTIL_ctype functions
These apparently made libtool sad on win32, and the function call
overhead here should be negligable anyway.
2010-09-01 15:01:39 -04:00
Nick Mathewson
acc4aca49e Fix a bug in our win32 condition implementation
The do ... while loop in our wait code could spin while waiting
because the event object wasn't reset until there were no longer any
events waiting to be woken up.  We also want to reset the event object
if the count of events to wake up reaches zero.

Found by Chris Davis.  Fixes bug 3053358.
2010-08-30 11:35:06 -04:00
Nick Mathewson
d61b2f3386 Fix an issue with forking and signal socketpairs in select/poll backends
Nicholas Marriott identifies an issue where a signal socketpair
doesn't get recreated if the event backend doesn't set event_reinit.

See bug 3048812

There may be a similar issue with respect to th_notify_fd
2010-08-26 15:11:35 -04:00
Nick Mathewson
041989fb66 Rename regress_pthread.c to regress_thread.c 2010-08-24 12:42:24 -04:00
Nick Mathewson
f1074b776a Detect events with no ev_base; warn instead of crashing 2010-08-23 12:01:45 -04:00
Nick Mathewson
743f866539 Honor NDEBUG; build without warnings with NDEBUG; make NDEBUG always-off in unit test code 2010-08-23 11:49:06 -04:00
Nick Mathewson
970e6ad2ba Avoid deadlock when activating signals.
Fixes bug 3048812.

Based on patch by Nicholas Marriott.
2010-08-19 14:07:36 -04:00