37 Commits

Author SHA1 Message Date
Nick Mathewson
2e36dbe1a6 Use EVUTIL_ASSERT() consistently instead of assert.
svn:r1464
2009-10-26 20:00:43 +00:00
Nick Mathewson
d8164d0cfc Fix win32 connect() event handling.
Christopher Davis reported:

    Connection failures aren't reported on Windows when
    using bufferevent_socket_connect, because Windows uses
    select's exceptfds to notify of failure, and libevent
    treats them like read events. Only the write event
    handler is currently used to handle connection events.

We should think hard about this one, since it changes
behavior from 1.4.x.  Anything that worked on Mac/Unix before
will work more consistently on Windows now... but this might
break stuff that worked only on Windows, but nowhere else.

Patch from Chris Davis.

svn:r1454
2009-10-21 07:00:14 +00:00
Nick Mathewson
ed748a48ba Fix win32 compilation.
svn:r1451
2009-10-21 04:45:59 +00:00
Nick Mathewson
6b22e74aa1 Add locking to event_base_loop.
This is harder than it sounds, since we need to make sure to
release the lock around the key call to the kernel (e.g.,
select, epoll_wait, kevent), AND we need to make sure that
none of the fields that are used in that call are touched by
anything that might be running concurrently in another
thread.  I managed to do this pretty well for everything but
poll().  With poll, I needed to introduce a copy of the
event_set structure.

This patch also fixes a bug in win32.c where we called
realloc() instead of mm_realloc().

svn:r1450
2009-10-21 03:54:00 +00:00
Nick Mathewson
a826a75800 Some tweaks to Brodie Thesfield's MSVC patch.
svn:r1386
2009-07-28 19:41:48 +00:00
Nick Mathewson
5b5b880be7 Various MSVC cleanups from Brodie Thiesfield.
svn:r1385
2009-07-28 19:41:39 +00:00
Nick Mathewson
a43a1c2b23 Fix compilation problems in win32.c
svn:r1322
2009-05-28 20:44:04 +00:00
Nick Mathewson
cdaca02c29 Activate fd events in a pseudorandom order on older backends.
New backends like poll and kqueue and so on add fds to the queue in
the order that they are triggered.  But the select backend currently
activates low-numbered fds first, whereas the poll and win32 backends
currently favor whatever fds have been on for the longest.  This is no
good for fairness.

svn:r1318
2009-05-27 15:35:00 +00:00
Nick Mathewson
8c66eb2e9b Try to contain the failure when we are running without socketpair().
Some win32 systems (mostly those using Kaspersky, it would seem)
prevent us from faking socketpair().  This makes our signal
notification code just not work.  Our response since 1.4 has been to
assert.  For users who would rather work without signals than not work
at all, this has been a regression from 1.3e.

This patch makes adding signal events fail in this case; there's no
reason to kill the whole process.

svn:r1303
2009-05-22 14:48:40 +00:00
Nick Mathewson
ebf294559e Compilation fixes for vc++ 2008 express. Not the end of them.
svn:r1260
2009-04-30 23:49:15 +00:00
Nick Mathewson
b85b710cf5 Update copyright statements to reflect the facts that:
a) this is 2009
b) niels and nick have been comaintainers for a while
c) saying "all rights reserved" when you then go on to explicitly
   disclaim some rights is sheer cargo-cultism.

svn:r1065
2009-01-27 22:34:36 +00:00
Nick Mathewson
89fe316779 Update win32 code to put indices in evmap.
svn:r1009
2009-01-14 21:13:58 +00:00
Nick Mathewson
9935d5b01e Fix win32 compilation. Surprisingly, unit tests pass too.
svn:r1002
2009-01-13 21:39:32 +00:00
Nick Mathewson
169321c9e6 Rename four internal headers to follow the -internal.h convention.
svn:r1000
2009-01-13 20:26:37 +00:00
Niels Provos
d776f8462b deprecate the usage of signal_{add,del,set} and name it evsignal_{add,del,set} instead; move the old definitions to compat
svn:r973
2008-12-23 22:23:37 +00:00
Niels Provos
02b2b4d1be Restructure the event backends so that they do not need to keep track of events themselves, as a side effect multiple events can use the same fd or signal.
svn:r972
2008-12-23 16:37:01 +00:00
Nick Mathewson
05965921ab Add new functions to access backends by their features and to query the features of a backend.
svn:r842
2008-05-31 14:37:31 +00:00
Nick Mathewson
04366d5acc r19677@catbus: nickm | 2008-05-11 20:51:41 -0400
Oops; we had not changed event_malloc() to mm_malloc() [etc] in win32.c


svn:r809
2008-05-12 00:51:48 +00:00
Niels Provos
fbe24f43ab remove obsoleted recalc code
svn:r581
2007-12-09 05:07:20 +00:00
Nick Mathewson
cd666f8071 Debug new win32 code: make bufferevents test pass.
svn:r576
2007-12-06 19:18:14 +00:00
Nick Mathewson
78d0de30b8 Fix compile warnings and errors in win32 build.
svn:r575
2007-12-06 18:38:50 +00:00
Nick Mathewson
2e2104f4ce r15172@tombo: nickm | 2007-12-06 12:54:37 -0500
Rewrite win32.c to use a red-black tree to map sockets to events.  This changes the performance from O(N^2) to O(N lg N).  Needs testing.  (This was made possible by recent changes to the implementation of non-persistent events.)


svn:r574
2007-12-06 18:13:03 +00:00
Nick Mathewson
7eb250e9c5 r14939@tombo: nickm | 2007-11-25 11:59:26 -0500
New function event_set_mem_functions to replace internal calls to malloc, free, etc with a user-supplied functions.


svn:r541
2007-11-25 17:14:19 +00:00
Nick Mathewson
4e1ec3e05e Make all the C files in the libraries compile under MSVC 2005 Express. There are still a few warnings, and probably some subtle issues, but it's better than nothing.
svn:r499
2007-11-07 21:01:26 +00:00
Nick Mathewson
794857242f Remove spurious #include <sys/tree.h> in win32.c.
svn:r493
2007-11-07 06:07:54 +00:00
Nick Mathewson
f0e06d75e5 r15217@catbus: nickm | 2007-09-20 14:04:32 -0400
Fix win32 signals: teach win32 that we have per-base signal queues; teach signal.c that not everybody has sigaction().


svn:r442
2007-09-20 18:26:46 +00:00
Nick Mathewson
12fe087e12 r14505@catbus: nickm | 2007-08-10 12:35:52 -0400
Fix win32 build errors (reported by Phobos): mingw gcc seems to dislike unnamed function parameters.


svn:r390
2007-08-10 16:37:33 +00:00
Niels Provos
41b7cbc381 more the signal base into the event base; this removes global state and makes signals
work better with threading; from Wouter Wijngaards
small fixes for kqueue and style by me


svn:r351
2007-03-10 06:37:53 +00:00
Niels Provos
b5d2f9a255 rolling back r339: evconfig.h does not work
svn:r341
2007-03-01 06:25:18 +00:00
Niels Provos
127c260bb7 make evconfig.h available as installed header file; not
really ideal but good enough for me; from Nick Mathewson


svn:r339
2007-02-28 04:02:29 +00:00
Niels Provos
868f10e7c9 mingw fixes from Nick
svn:r271
2006-11-22 01:21:10 +00:00
Niels Provos
9f7d28bb81 make it compile with mingw; from Nick
svn:r235
2006-09-27 03:07:38 +00:00
Niels Provos
2e8051f593 introduce a way to free the base from Nick Mathewson <nickm@freehaven.net>
svn:r210
2006-03-28 04:40:54 +00:00
Niels Provos
0c48c70680 windows memory corruption bug fix from I-M Weasel via Nick Mathewson.
svn:r189
2005-12-08 23:05:42 +00:00
Niels Provos
99442c6f00 windows fixes from Nick Mathewson <nickm@freehaven.net>
svn:r135
2005-03-29 06:54:36 +00:00
Niels Provos
42b9795867 make it compile again; from dug song
svn:r130
2005-02-04 11:17:18 +00:00
Niels Provos
ee8cc84e9f Windows support from Mike Davis
svn:r74
2003-09-23 22:28:01 +00:00