Nick Mathewson
a0912e3206
Check more setsockopt return values when binding sockets. Found by coverity
2012-07-26 10:39:05 -04:00
Nick Mathewson
e49e289129
Update copyright notices to 2012
2012-02-10 17:29:53 -05:00
Nick Mathewson
ecfc720a4f
Make evconnlistener work around bug in older Linux when getting nmapped
...
Older Linuxes sometimes respond to some nmap probes by having accept()
return a success but with socklen 0. That can lead to confusing behavior
when you go to process the sockaddr.
2012-01-09 11:49:41 -05:00
Nick Mathewson
3c824bd334
Update copyright dates to 2011.
2011-10-24 13:18:09 -04:00
Peter Rosin
816115a17e
InitializeCriticalSectionAndSpinCount requires _WIN32_WINNT >= 0x0403.
2011-05-27 23:14:10 -04:00
Evan Jones
fbe64f216c
Use relative includes instead of system includes consistently.
2010-12-02 11:03:55 -05:00
Kelly Brock
2599b2d5f5
Minor fix for IOCP shutdown handling fix
...
Call setsockopt() on the actual new socket, not on as->s, which was
set to INVALID_SOCKET.
2010-11-30 11:34:26 -05:00
Nick Mathewson
52aa419bf6
Set SO_UPDATE_ACCEPT_CONTEXT on sockets from AcceptEx so that shutdown() can work
...
Based on patch (and lots of debugging work) by Kelly Brock.
2010-11-05 10:12:06 -04:00
Christopher Davis
7b40a00050
Make sure IOCP evconnlistener uses virtual events.
2010-10-28 14:11:33 -04:00
Nick Mathewson
46ee061ca0
Add a function to change a listener's callback.
...
You can also now initialize listeners with no callbacks set; if so,
they won't get enabled until the callback is set to non-NULL.
2010-10-25 11:47:05 -04:00
Nick Mathewson
120570356b
Turn some booleans in evconnlistener_iocp into one-bit bitfields.
2010-10-07 18:11:38 -04:00
Christopher Davis
62b429afa8
Make iocp/listener/error work; don't accept again if lev is disabled.
2010-10-07 18:11:38 -04:00
Nick Mathewson
481ef92086
Fix allocation error for IOCP listeners. Probably harmless, since struct event is big
2010-10-07 18:11:37 -04:00
Nick Mathewson
127d4f2195
Add a LEV_OPT_THREADSAFE option for threadsafe evconnlisteners
2010-10-07 18:11:19 -04:00
Nick Mathewson
5b7a370636
Fix warnings on mingw with gcc 4.5
2010-10-05 14:29:48 -04:00
Nick Mathewson
045eef4cde
Unit tests for listener error callbacks
2010-09-23 14:23:45 -04:00
Simon Perreault
c4be8d82b3
Add error callback to evconnlistener
2010-09-22 15:54:18 -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
fab50488fc
Expose a function to getsockname() on a listener's fd.
2010-09-03 16:41:16 -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
Sebastian Sjöberg
899c1dcc98
Replace EVUTIL_CLOSESOCKET macro with a function
...
The EVUTIL_CLOSESOCKET() macro required you to include unistd.h in your
source for POSIX. We might as well turn it into a function: an extra
function call is going to be cheap in comparison with the system call.
We retain the EVUTIL_CLOSESOCKET() macro as an alias for the new
evutil_closesocket() function.
(commit message from email by Nick and Sebastian)
2010-04-14 15:42:57 -04:00
Nick Mathewson
17efc1cdfa
Update all our copyright notices to say "2010"
2010-03-04 01:38:48 -05:00
Nick Mathewson
e5cf98795e
Clean up formatting: remove trailing spaces
2010-02-18 17:46:56 -05:00
Nick Mathewson
cb52838fc5
When working without a current event base, don't try to use IOCP listeners
...
This fixes a bug turned up with the http unit tests, where we create
the evhttp object using an implicit (NULL) event_base. This failed
pretty badly when we tried to use IOCP-based listeners. We could
hunt for the current base from inside listener.c in the future, or
get the iocp base some other way, but for now this is probably the safest
solution.
2010-02-18 00:27:35 -05:00
Nick Mathewson
cef61a2f1b
Use ev_[u]intptr_t types in place of [u]intptr_t
2010-01-26 12:08:17 -05:00
Nick Mathewson
a19b4a05e6
Call event_debug_unassign on internal events
...
I don't expect that many users will be so religious about calling
unassign, but we need to be so that it's at least possible to use
debug mode without eating memory.
2010-01-25 13:53:17 -05:00
Jardel Weyrich
510ab6bce0
Comestic changes in evconnlistener_new(), new_accepting_socket(), accepted_socket_invoke_user_cb() and iocp_listener_enable().
2010-01-08 23:28:54 -05:00
Jardel Weyrich
fec66f9685
Improved error handling in evconnlistener_new_async(). Also keeping the fd open because it is not opened by this function, so the caller is responsible for closing it. Additionally, since evconnlistener_new_bind() creates a socket and passes it to the function above, it required error checking to close the same socket.
2010-01-08 23:28:23 -05:00
Jardel Weyrich
4367a33a20
Fixed a fd leak in start_accepting(), plus cosmetic changes
2010-01-08 23:27:26 -05:00
Jardel Weyrich
d0939d2b97
Introduced evutil_make_socket_closeonexec() to preserve fd flags for F_SETFD.
...
Use this to eliminate the various macros that called F_SETFD throughout
the code.
2009-12-29 15:12:56 -05:00
Jardel Weyrich
24fb502f70
Fix an fd leak in evconnlistener_new_bind().
2009-12-28 16:01:12 -05:00
Nick Mathewson
784b8773a4
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
2009-11-06 21:46:57 +00:00
Nick Mathewson
0aa6f5136a
Fix remaining AcceptEx issues.
...
svn:r1492
2009-11-02 20:59:13 +00:00
Nick Mathewson
e794d716a3
Clean up acceptex code some more: add locking, single-threading, enable/disable.
...
svn:r1491
2009-11-02 20:20:40 +00:00
Nick Mathewson
a84c87d76a
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
2009-11-02 19:51:26 +00:00
Nick Mathewson
9a772148f2
Compilation and correctness fixes for IOCP listener code.
...
svn:r1489
2009-11-02 19:31:29 +00:00
Nick Mathewson
5d2c1650f3
More refactoring for IOCP listener code
...
svn:r1486
2009-11-02 17:42:09 +00:00
Nick Mathewson
20f5bdfd6b
Refactor evconnlistener to allow multiple implementations; add an (incomplete, not-yet-integrated) IOCP implementation.
...
svn:r1480
2009-10-29 19:25:33 +00:00
Nick Mathewson
75fe762e03
Accessor function to get a listener's associated fd
...
svn:r1390
2009-07-30 17:00:56 +00:00
Nick Mathewson
1ee65b7f94
Do not assume we know the value for FD_CLOEXEC.
...
svn:r1301
2009-05-21 20:59:17 +00:00
Nick Mathewson
7e3ea82ee6
Disallow backlog==0 in evconnlistener_new_bind().
...
svn:r1300
2009-05-21 20:59:09 +00:00
Nick Mathewson
ed1bbc7a9f
Tweak the evconnlistener interface a little.
...
svn:r1295
2009-05-18 16:15:56 +00:00
Nick Mathewson
659d54d530
Add new code to make and accept connections.
...
This is stuff that it's easy to get wrong (as I noticed when writing
bench_http), and that takes up a fair amount of space (see http.c).
Also, it's something that we'll eventually want to abstract to use
IOCP, where available.
svn:r1272
2009-05-05 02:59:26 +00:00