1685 Commits

Author SHA1 Message Date
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
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
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
Nick Mathewson
6123d1298f Fix kquue correctness test on x84_64
Apparently, in our configure.in check for a working kqueue, we were
leaving some fields unset that seemed to irritate 64-bit kqueue a lot.

Found by Christopher Layne
2010-08-19 09:43:04 -04:00
Nick Mathewson
4c32b9de2c Fix logic error in win32 TRY_LOCK that caused problems with rate-limiting 2010-08-18 12:02:25 -04:00
Nick Mathewson
d0b884338f Set close-on-exec bit for filedescriptors created by dns subsystem.
Based on patch for 1.4 by Ralf Schmitt.
2010-08-18 10:49:12 -04:00
Nick Mathewson
da6e7cd495 Correctly detect failure to delete bufferevent read-timeout event
Gilad Benjamini noted that we check the error code for deleting a
write-timeout event twice, and the read timeout not at all.  This
shouldn't be a bit problem, since it's really hard for a delete to
fail on a timeout-only event, but it's worth fixing.

Fixes bug 3046787
2010-08-17 13:26:03 -04:00
Nick Mathewson
5fb1095824 Add a unit test for conditions 2010-08-17 13:21:05 -04:00
Nick Mathewson
d74ae381e0 Make the regress_pthread.c tests work on windows with current test APIs 2010-08-17 13:21:05 -04:00
Nick Mathewson
e0972c2138 Use conditions instead of current_event_lock to fix a deadlock.
Avi Bab correctly noted as bug 3044479 the fact that any thread
blocking on current_event_lock will do so while holding
th_base_lock, making it impossible for the currently running event's
callback to call any other functions that require th_base_lock.

This patch switches the current_event_lock code to instead use a
condition variable that we wait on if we're trying to mess with
a currently-executing event, and that we signal when we're done
executing a callback if anybody is waiting on it.
2010-08-17 13:18:18 -04:00
Nick Mathewson
d4977b52f0 Add a condition variable backend, with implementations for pthreads and win32
The interface from the user's POV is similar to the locking
implementation: either provide a structure full of function
pointers, or just call evthread_use_*_threads() and everything will
be okay.

The internal interface is meant to vaguely resemble pthread_cond_*,
which Windows people will better recognize as *ConditionVariable*.
2010-08-17 13:15:34 -04:00
Gilad Benjamini
3920172821 Make definition of WIN32_LEAN_AND_MEAN in event.h conditional.
(Inclusion order might trigger a warning for redefinition on Windows.)
2010-08-13 17:19:18 -04:00
Gilad Benjamini
60433a0a1a Clean up syntax on TAILQ_ENTRY() usage
Though the C standards allow it, it's apparently possible to get MSVC
upset by saying "struct { int field; } (declarator);" instead of
"struct {int field; } declarator;", so let's just not do that.

Bugfix for 3044492

(commit msg by nickm)
2010-08-13 17:08:59 -04:00
Nick Mathewson
a4af9be10a Make include/event2/event-config.h not included in source dist
As a generated file, it shouldn't get included in our source
distribution.  Apparently there is an automake incant for this:
nobase_ even stacks with nodist_ .
2010-08-13 11:41:37 -04:00
Nick Mathewson
4022b287f8 Change include order in Makefile.nmake
If there is an event-config.h in include/event2 (either because we
screwed up packaging like in 2.0.6-rc or because we previously tried
building with mingw and we didn't make distclean in the middle), we
want MSVC to find the one one in WIN32-Code/include/event2 first.

Found by Gilad Benjamini.
2010-08-13 11:34:39 -04:00
Nick Mathewson
4991669b7c Update the whatsnew-2.0.txt document 2010-08-10 21:05:52 -04:00
Nick Mathewson
33200e72de Document that DNS_NO_SEARCH is an obsolete alias for DNS_QUERY_NO_SEARCH 2010-08-10 15:03:14 -04:00
Nick Mathewson
3808168d21 Completely remove the (mostly-removed) obsolete thread functions. 2010-08-10 15:02:50 -04:00
Nick Mathewson
9b5c19ac87 Merge branch 'more_pkgconfig' 2010-08-10 11:46:00 -04:00
Nick Mathewson
ebcb1f0387 Add pkgconfig files for libevent_{openssl,pthreads} 2010-08-10 11:11:25 -04:00
Nick Mathewson
0bffe43a15 Fix a nasty dangling-event bug when using rate-limiting groups
When we freed a bufferevent that was in a rate-limiting group and
blocked on IO, the process of freeing it caused it to get removed
from the group.  But removing the bufferevent from the group made
its limits get removed, which could make it get un-suspended and in
turn cause its events to get re-added.  Since we would then
immediately _free_ the events, this would result in dangling
pointers.

Fixes bug 3041007.
2010-08-09 12:08:40 -04:00
Nick Mathewson
ff481a8e43 Increment vesion to 2.0.6-rc-dev 2010-08-06 23:22:01 -04:00
Nick Mathewson
556d0f4001 Increment versions to 2.0.6-rc release-2.0.6-rc 2010-08-06 21:19:44 -04:00
Nick Mathewson
f658264041 Changlog and new acknowledgements for 2.0.6-rc 2010-08-06 21:11:01 -04:00
Nick Mathewson
ec347b9225 Move event-config.h to include/event2
This change means that all required include files are in event2, and
all files not in event2/* are optional.
2010-08-06 20:21:27 -04:00
Nick Mathewson
5fa30d2bf4 Fix evdns build with -DUNICODE
It turns out that GetProcAddress always takes its second argument as
a C string, regardless of whether unicode is on or not.
2010-08-06 17:13:27 -04:00
Nick Mathewson
28f31a4f8d Fix unit tests with -DUSE_DEBUG enabled
If you were to enable USE_DEBUG and slog through all 700+ MB of
debugging output, you'd find that one of the unit tests failed,
since it tested the debug logging code, but the string it expected
and the string it logged differed by a tab vs 2 spaces.
2010-08-06 16:36:23 -04:00