|
5880e4a1
|
2012-02-14T18:04:52
|
|
Support TCP_DEFER_ACCEPT sockopts for listeners
A listening socket can be enabled with the sockopt
TCP_DEFER_ACCEPT. This informs the kernel to not call the user-land
accept() until real data has been written to the socket.
A new flag LEV_OPT_DEFERRED_ACCEPT has been introduced to
automatically set this option. Optionally
evutil_make_tcp_listen_socket_deferred() can be called manually.
(Tweaked slightly by nickm.)
|
|
a220a081
|
2012-02-15T21:07:44
|
|
Merge remote-tracking branch 'github/21_fast_syscalls'
|
|
2ed44302
|
2012-02-14T11:48:55
|
|
If open(O_CLOEXEC) fails, fall back to fcntl(CLOEXEC)
This is needed for folks who build with recent Linux kernel headers
but run with older kernels.
|
|
27931976
|
2012-02-11T21:20:47
|
|
Merge remote-tracking branch 'origin/patches-2.0'
|
|
03dce42d
|
2012-02-11T21:17:18
|
|
Tweak the evutil_open_closeonexec patch to work on windows, old unixes.
Windows doesn't have a mode_t as far as I can tell.
Some unixes, iirc, don't like three-argument open without O_CREAT.
|
|
d2b5f722
|
2012-02-11T17:23:17
|
|
Make uses of open() close-on-exec safe by introducing evutil_open_closeonexec.
In a multi-process/threaded environment, opening fds internally
without the close-on-exec flag could leak fds to child processes.
|
|
539466e5
|
2012-02-10T17:33:50
|
|
Merge remote-tracking branch 'origin/patches-2.0'
Conflicts:
Makefile.am
WIN32-Code/event2/event-config.h
configure.in
|
|
e49e2891
|
2012-02-10T17:29:53
|
|
Update copyright notices to 2012
|
|
a1c042bf
|
2012-02-10T15:55:15
|
|
Infrastructure for using faster/fewer syscalls when creating sockets
Linux provides some features that allow avoiding extra calls to
fcntl when creating new nonblocking/close-on-exec sockets, so
we can add wrapper functions to emulate those when they are not
available.
Additionally, even when we are emulating those functions, we can
take a fast path that cuts our fcntl calls in half: we don't need to
look up the previous value of a file's flags when we have just
created it.
|
|
f25d9d32
|
2012-01-24T11:42:26
|
|
Add an (internal) usleep function for use by unit tests
|
|
40a3c52d
|
2012-01-22T22:27:16
|
|
Fix compilation of windows evutil_check_ifaddrs
|
|
e0f0dbf9
|
2011-12-08T14:11:30
|
|
Remove some accidentally-committed debugging code
|
|
7085a456
|
2011-12-07T18:16:32
|
|
Use getifaddrs to detect our interfaces if possible
The old scheme involved connected UDP sockets and getsockname(), and is
generally best avoied.
|
|
0cb70e33
|
2011-10-26T10:17:21
|
|
Merge remote-tracking branch 'origin/patches-2.0'
|
|
3c824bd3
|
2011-10-24T13:18:09
|
|
Update copyright dates to 2011.
|
|
b260065a
|
2011-08-28T14:06:03
|
|
Merge remote-tracking branch 'origin/patches-2.0'
|
|
7c11e51e
|
2011-08-27T05:48:11
|
|
Clean up some problems identified by Coverity.
|
|
2bbed8fe
|
2011-07-02T21:50:49
|
|
Merge remote-tracking branch 'origin/patches-2.0'
|
|
8ee9f9c1
|
2011-07-02T21:49:07
|
|
Fix a few warnings on OpenBSD
- redeclaration of dst_size
- arpa/inet.h requires netinet/in.h first
- don't use a local with the same name as a global - it isn't needed so
remove it
|
|
9f560bfa
|
2011-05-25T19:50:56
|
|
Use "_WIN32", not WIN32: it's standard and we don't need to fake it
This patch was automatically generated with perl.
Based on a patch by Peter Rosin.
|
|
bfdda265
|
2011-04-05T17:22:36
|
|
Merge remote-tracking branch 'origin/patches-2.0'
|
|
1a21d7b8
|
2011-04-05T17:21:12
|
|
Fix the check for multicast or broadcast addresses in evutil_check_interfaces
First of all, it is totally okay to have an address end with .255,
depending on what your netmask is, so we shouldn't reject a local
address if it ends with .255.
Second, our check for ending with .255 was broken. So was our check
for class-d addresses.
Found by Dave Hart.
|
|
d7c0ffa1
|
2011-04-05T17:19:00
|
|
Merge remote-tracking branch 'origin/patches-2.0'
|
|
637d17a1
|
2011-04-05T16:32:39
|
|
Check for allocation failures in apply_socktype_protocol_hack
|
|
22845886
|
2011-01-31T16:45:23
|
|
Merge remote branch 'origin/patches-2.0'
|
|
3c8f4e75
|
2011-01-31T16:44:06
|
|
Add compile-time check for AF_UNSPEC==PF_UNSPEC
|
|
cb921139
|
2011-01-31T16:32:05
|
|
Build on systems without AI_PASSIVE
|
|
453317b2
|
2011-01-24T18:22:32
|
|
Fall back to sscanf if we have no other way to implement strtoll
|
|
8b0afe96
|
2011-01-12T21:41:58
|
|
Merge remote branch 'origin/patches-2.0'
|
|
666b0966
|
2010-12-18T01:07:27
|
|
Detect and handle more allocation failures.
|
|
9b27b307
|
2011-01-02T08:04:12
|
|
Remove event-private.h and switch to evconfig-private.h
|
|
c51ef930
|
2010-12-22T23:24:01
|
|
Eliminate a couple more manual internal _GNU_SOURCE defines
|
|
b8b8aa56
|
2010-09-02T17:52:20
|
|
Use GetSystemTimeAsFileTime to implement gettimeofday on win32.
It is (in my benchmarks) way faster than _ftime, though the
conversion process is not so straightforward. In theory, it can
have a better granularity too, though in practice who knows what
you're getting.
|
|
22f4af65
|
2010-12-09T11:43:12
|
|
Remove end-of-line whitespace
|
|
32390732
|
2010-11-23T19:40:23
|
|
Fix snprintf related failures on IRIX.
|
|
49418612
|
2010-11-16T12:55:10
|
|
Use the US-English "canceled", not the UK "cancelled".
|
|
a3245afe
|
2010-11-01T14:23:33
|
|
Fix win32 build in response to fixes from win64 build.
|
|
f8095d64
|
2010-11-01T14:15:34
|
|
Fix a typo in 7484df61c981fc33db2~
|
|
7484df61
|
2010-11-01T13:43:43
|
|
Fix even more win64 warnings
|
|
19c71e74
|
2010-10-27T10:36:08
|
|
Fix som event_warns that should have been event_warnx
|
|
f5ad31c1
|
2010-10-27T12:47:07
|
|
Check return value for ioctlsocket on win32
|
|
a8b7674c
|
2010-09-28T01:09:17
|
|
Merge remote branch 'github/signed_compare'
|
|
d49b5e33
|
2010-09-27T15:12:55
|
|
Do not search outside of the system directory for windows DLLs
Hardens against some attacks.
|
|
9c8db0f8
|
2010-09-23T22:45:55
|
|
Fix all warnings in the main codebase flagged by -Wsigned-compare
Remember, the code
int is_less_than(int a, unsigned b) {
return a < b;
}
is buggy, since the C integer promotion rules basically turn it into
int is_less_than(int a, unsigned b) {
return ((unsigned)a) < b;
}
and we really want something closer to
int is_less_than(int a, unsigned b) {
return a < 0 || ((unsigned)a) < b;
}
.
Suggested by an example from Ralph Castain
|
|
57d3413c
|
2010-09-08T11:39:24
|
|
Merge remote branch 'github/globals'
|
|
e50c0fcc
|
2010-09-02T11:10:50
|
|
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.
|
|
1fdec20f
|
2010-09-01T15:01:39
|
|
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.
|
|
ec347b92
|
2010-07-07T16:45:03
|
|
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.
|
|
57b30cd7
|
2010-08-06T13:01:32
|
|
Turn our socketpair() replacement into its own function
This patch splits the formerly windows-only case of evutil_socketpair()
into an (internal-use-only) function named evutil_ersatz_socketpair(), and
makes it build and work right on non-Windows hosts.
We need this for convenience to test sendfile on solaris, where socketpair
can't give you an AF_INET pair, and sendfile() won't work on AF_UNIX.
|
|
7c2dea16
|
2010-07-13T11:06:08
|
|
Pass flags to fcntl(F_SETFL) and fcntl(F_SETFD) as int, not long
Everybody but Linux documents this as taking an int, and Linux is
very tolerant of getting an int instead. If it weren't, everybody
doing fcntl(fd,F_SETFL,O_NONBLOCK) would break, since the glibc
headers define O_NONBLOCK as an int literal.
|
|
0798dd12
|
2010-05-27T22:37:09
|
|
Close the file in evutil_read_file whether there's an error or not.
evutil_read_file would close the file if there was an error, but not if things went normally.
|
|
47c5dfbe
|
2010-05-18T17:28:51
|
|
Remove some dead assignments
|
|
8c3452bc
|
2010-05-18T13:55:32
|
|
Correctly recognize .255 addresses as link-local when looking for interfaces
|
|
c1cd32a1
|
2010-05-08T22:21:52
|
|
Define _REENTRANT as needed on Solaris, elsewhere
It turns out that _REENTRANT isn't only needed to make certain
functions visible; we also need it to make pthreads work properly
some places (like Solaris, where forgetting _REENTRANT basically
means that all threads are sharing the same errno). Fortunately,
our ACX_PTHREAD() configure macro already gives us a PTHREAD_CFLAG
variable, so all we have to do is use it.
|
|
935e1504
|
2010-05-08T19:36:05
|
|
Fix whitespace in evutil.c
|
|
35570716
|
2010-05-08T19:16:47
|
|
Fix another nasty solaris getaddrinfo() behavior
Everybody else thinks that when you getaddrinfo() on an ip address
and don't specify the protocol and the socktype, it should give you
multiple answers , one for each protocol/socktype implementation.
OpenSolaris takes a funny view of RFC3493, and leaves the results set
to 0.
This patch post-processes the getaddrinfo() results for consistency.
|
|
2cf2a286
|
2010-04-21T11:57:55
|
|
Fix getaddrinfo with protocol unset on Solaris 9. Found by Dagobert Michelsen
Apparently when you call Solaris 9's getaddrinfo(), it likes to leave
ai_protocol unset in the result. This is no way to behave, if I'm
reading RFC3493 right.
This patch makes us check for a getaddrinfo() that's broken in this way,
and work around it by trying to infer socktype and protocol from one
another.
Partial bugfix for 2987542
|
|
20fda296
|
2010-05-03T13:00:00
|
|
Try /proc on Linux as entropy fallback; use sysctl as last resort
It turns out that the happy fun Linux kernel is deprecating sysctl,
and using sysctl to fetch entropy will spew messages in the kernel
logs. Let's not do that. Instead, let's call sysctl for our
entropy only when all other means fail.
Additionally, let's add another means, and try
/proc/sys/kernel/random/uuid if /dev/urandom fails.
|
|
b1c79500
|
2010-04-23T14:42:25
|
|
Make evdns logging threadsafe
The old logging code was littered with places where we stored messages in
static char[] fields. This is fine in a single-threaded program, but if you
ever tried to log evdns messages from two threads at once, you'd hit a race.
This patch also refactors evdns's debug_ntop function into a more useful
evutil_sockaddr_port_format() function, with unit tests.
|
|
899c1dcc
|
2010-04-14T15:42:57
|
|
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)
|
|
8f9e60c8
|
2010-04-09T19:16:09
|
|
Always round up when there's a fractional number of msecs.
|
|
850c3ff2
|
2010-03-31T20:30:55
|
|
Add evutil_tv_to_msec for safe conversion of timevals to milliseconds.
This is useful for backends that require their timeout values be in
milliseconds.
|
|
cdd4c490
|
2010-03-11T00:38:46
|
|
Try to comment some of the event code more
|
|
b677032b
|
2010-03-08T13:46:04
|
|
Avoid errors in evutil.c when building with _UNICODE defined
|
|
17efc1cd
|
2010-03-04T01:25:51
|
|
Update all our copyright notices to say "2010"
|
|
57b72488
|
2010-02-27T22:27:13
|
|
Small cleanups on freebsd-connect-refused patch.
There should be no need to call be_socket_enable: that does an
event_add(). What we really want to do is event_active(), to make
sure that the writecb is executed.
Also, there was one "} if () {" that was missing an else.
I've noted that the return value for evutil_socket_connect() is
getting screwy, but since that isn't an exported function, we can fix
it whenever.
|
|
7bc48bfd
|
2010-02-27T18:59:06
|
|
deal with connect() failing immediately
|
|
4faeaea9
|
2010-02-19T03:39:50
|
|
Clean up formatting: function/keyword spacing consistency.
- Keywords always have a space before a paren. Functions never do.
- No more than 3 blank lines in a row.
|
|
e5bbd40a
|
2010-02-18T17:41:15
|
|
Clean up formatting: use tabs, not 8-spaces, to indent.
|
|
d4de062e
|
2010-02-10T17:19:18
|
|
Add an arc4random implementation for use by evdns
Previously, evdns was at the mercy of the user for providing a good
entropy source; without one, it would be vulnerable to various
active attacks.
This patch adds a port of OpenBSD's arc4random() calls to Libevent
[port by Chris Davis], and wraps it up a little bit so we can use it
more safely.
|
|
6810bdb1
|
2010-02-05T13:50:51
|
|
Always use our own gai_strerror() replacement.
This is necessary if we have any errors that the platform gai_strerror()
doesn't know how to handle.
|
|
c18490e6
|
2010-02-05T01:09:01
|
|
Add a check to make soure our EVUTIL_AI flags do not conflict with the native ones
|
|
5c7a7bca
|
2010-01-23T20:07:05
|
|
Fix windows and msvc build
|
|
918e9c5e
|
2010-01-23T16:38:36
|
|
Fix a number of warnings from gcc -pedantic
|
|
26e1b6f2
|
2010-01-21T01:51:40
|
|
Remove some commented-out code in evutil
|
|
8d4aaf90
|
2010-01-20T12:56:54
|
|
Don't use a bind address for nameservers on loopback
If the user sets a bind address to use for nameservers, and a
nameserver happens to be on 127.0.0.1, the nameserver will generally
fail. This patch alters this behavior so that the bind address is
only applied when the nameserver is on a non-loopback address.
|
|
0f7144fd
|
2009-12-07T17:21:13
|
|
Refactor code from evdns into a new internal "read a file" function.
|
|
ba2945f9
|
2010-01-06T17:59:44
|
|
Merge branch 'ratelimit'
Conflicts:
bufferevent_async.c
|
|
165d30e3
|
2009-12-30T14:29:56
|
|
Fix compilation of rate-limiting code on win32.
|
|
d0939d2b
|
2009-12-29T16:21:26
|
|
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.
|
|
4df7dbcb
|
2009-12-29T16:19:24
|
|
Adjusted fcntl() retval comparison on evutil_make_socket_nonblocking().
Apparently, a successful return value on F_SETFL is "anything but
-1".
|
|
5a43df82
|
2009-12-28T16:03:47
|
|
Improve readability of evutil_unparse_protoname()
|
|
0d64051f
|
2009-12-28T16:01:59
|
|
Fix a bogus free in evutil_new_addrinfo()
|
|
4c8b7cdc
|
2009-12-28T16:00:05
|
|
Make evutil_make_socket_nonblocking() leave any other flags alone.
Fixes bug 2922121
|
|
f070a4ae
|
2009-11-18T23:18:55
|
|
Do the proper hack for the (Open)BSD getaddrinfo quirk.
From evutil.c:
Some older BSDs (like OpenBSD up to 4.6) used to believe that
giving a numeric port without giving an ai_socktype was verboten.
We test for this so we can apply an appropriate workaround. If it
turns out that the bug is present, then:
- If nodename==NULL and servname is numeric, we build an answer
ourselves using evutil_getaddrinfo_common().
- If nodename!=NULL and servname is numeric, then we set
servname=NULL when calling getaddrinfo, and post-process the
result to set the ports on it.
We test for this bug at runtime, since otherwise we can't have the
same binary run on multiple BSD versions.
svn:r1550
|
|
201d8d0b
|
2009-11-17T18:29:44
|
|
Clarify even more about various system-specific problems with getaddrinfo
svn:r1542
|
|
9151d000
|
2009-11-17T03:36:43
|
|
Use the common-case code from getaddrinfo_common *always*; OS differences are just too huge.
svn:r1541
|
|
3451c870
|
2009-11-17T02:57:32
|
|
Never pass our weird flags to the system getaddrinfo. Make sure there is no overlap between flag values.
svn:r1540
|
|
888007f9
|
2009-11-17T02:38:19
|
|
Windows *does* have getservbyname, no matter what autoconf says.
TODO: figure out why autoconf is confused about this.
svn:r1538
|
|
86f57420
|
2009-11-16T22:25:46
|
|
Add two implementations of getaddrinfo: one blocking and one nonblocking.
The entry points are evutil_getaddrinfo and evdns_getaddrinfo respectively.
There are fairly extensive unit tests.
I believe this code conforms to RFC3493 pretty closely, but there are
probably more issues. It should get tested on more platforms.
This code means we can dump the well-intentioned but weirdly-implemented
bufferevent_evdns and evutil_resolve code.
svn:r1537
|
|
629a6133
|
2009-11-15T18:59:59
|
|
When running set[ug]id, don't check the environment.
Idea from OpenBSD, but made a bit more generic to handle uncivilized lands
that do not define issetugid.
svn:r1530
|
|
784b8773
|
2009-11-06T21:46:57
|
|
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
|
|
0b9eb1bf
|
2009-11-03T20:40:48
|
|
Add a bufferevent function to resolve a name then connect to it.
This function, bufferevent_socket_connect_hostname() can either use
evdns to do the resolve, or use a new function (evutil_resolve) that
uses getaddrinfo or gethostbyname, like http.c does now.
This function is meant to eventually replace the hostname resolution mess in
http.c.
svn:r1496
|
|
25af6954
|
2009-10-14T00:46:47
|
|
When a bufferevent_connect() call fails, give the client an error callback.
Patch from Christopher Davis.
svn:r1444
|
|
621aafd2
|
2009-07-30T22:11:23
|
|
Export sockaddr comparison functionality.
svn:r1400
|
|
7c20a6ae
|
2009-07-30T17:01:21
|
|
Export an ev_socklen_t.
svn:r1391
|
|
72ea534f
|
2009-07-28T19:41:57
|
|
Export evutil_str[n]casecmp as evutil_ascii_str[n]casecmp.
svn:r1387
|
|
709c21c4
|
2009-07-28T04:03:57
|
|
Bufferevent support for openssl.
This code adds a new Bufferevent type that is only compiled when the
openssl library is present. It supports using an SSL object and an
event alert mechanism, which can either be an fd or an underlying
bufferevent.
There is still more work to do: the unit tests are incomplete, and we
need to support flush and shutdown much better. Sometimes events are
generated needlessly: this will hose performance.
There's a new encrypting proxy in sample/le-proxy.c.
This code has only been tested on OSX, and nowhere else.
svn:r1382
|
|
043515bc
|
2009-07-14T18:50:06
|
|
Stop using C++ style comments.
svn:r1343
|
|
01be8708
|
2009-06-11T19:09:08
|
|
Fix compile on cygwin. This isnt the solution I would like: I would prefer to get pton and ntop to work even when AF_INET6 is not defined.
svn:r1326
|