|
fbe64f21
|
2010-12-02T10:26:12
|
|
Use relative includes instead of system includes consistently.
|
|
7bcace2d
|
2010-11-22T21:02:34
|
|
Fix some irix compilation warnings spotted by Kevin Bowling
|
|
d51b2fc6
|
2010-11-19T12:14:18
|
|
Make evdns_getaddrinfo_cancel threadsafe
|
|
c7cfbcf4
|
2010-11-19T12:01:05
|
|
Fix some more cancel-related bugs in getaddrinfo_async
Also imposed a new rule to make this much much simpler: no freeing
the getaddrinfo request until both dns callbacks have been invoked.
|
|
abf01ed1
|
2010-11-19T11:33:48
|
|
Avoid double-invocation of user callback with EVUTIL_EAI_CANCEL
|
|
49418612
|
2010-11-16T12:55:10
|
|
Use the US-English "canceled", not the UK "cancelled".
|
|
5c8a59e8
|
2010-11-09T10:19:05
|
|
Merge remote branches 'github/20_evdns_cancel_segfault_v2', 'github/20_http_close_detect', 'github/20_http_versions', 'github/20_more_http_methods', 'github/20_shutdown_iocp_listener' and 'github/20_win64_fixes'
|
|
9ed30de7
|
2010-11-03T12:37:37
|
|
Don't free evdns_request handles until after the callback is invoked
Previously, once the callback was scheduled, it was unsafe to cancel
a request, but there was no way to tell that. Now it is safe to
cancel a request until the callback is invoked, at which point it
isn't.
Found and diagnosed by Denis Bilenko.
|
|
ba014569
|
2010-11-02T12:42:35
|
|
Use the label_len local variable in evdns instead of recalculating it over and over
|
|
545a6114
|
2010-11-01T13:59:04
|
|
Fix even more win64 warnings: buffer, event_tagging, http, evdns, evrpc
|
|
5b7a3706
|
2010-10-05T14:29:48
|
|
Fix warnings on mingw with gcc 4.5
|
|
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
|
|
749128b2
|
2010-09-04T22:02:32
|
|
Merge remote branch 'github/win32_posix_underscore'
|
|
19521436
|
2010-09-03T16:42:16
|
|
Expose a function to add a nameserver by sockaddr
|
|
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.
|
|
d0b88433
|
2010-08-18T10:49:12
|
|
Set close-on-exec bit for filedescriptors created by dns subsystem.
Based on patch for 1.4 by Ralf Schmitt.
|
|
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.
|
|
5fa30d2b
|
2010-08-06T17:13:27
|
|
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.
|
|
cc2379d2
|
2010-07-26T14:48:32
|
|
Constify a couple of arguments to evdns_server_request_add_*_reply
|
|
e1c1167c
|
2010-07-22T14:38:08
|
|
Replace (unused,always 0) is_tcp argument to evdns_add_server_port*() with flags
Since we weren't using it for anything, and we always failed if it was
set, we're allowed to change the future semantics of setting it.
|
|
7e87a599
|
2010-07-21T14:33:42
|
|
Stop asserting when asked for a (unsupported) TCP dns port. Just return NULL.
|
|
899b0a39
|
2010-05-24T15:24:03
|
|
Use generic win32 interfaces, not ASCII-only ones, where possible.
|
|
b14f151b
|
2010-05-18T17:27:06
|
|
If no evdns request can be launched, return NULL, not a handle
Some of our evdns code was willing to return an evdns_request with
handle->current_req set to NULL. Really, those cases should just
return NULL.
|
|
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.
|
|
ceefbe87
|
2010-04-23T14:04:03
|
|
Add a comment to explain why evdns_request is now separte from request
|
|
67072f3c
|
2010-04-22T21:46:05
|
|
Assert for valid requests as necessary.
A valid request has an associated handle, and the handle must point
to the request.
|
|
a6258400
|
2010-04-21T22:20:10
|
|
Free search state when finished searching to avoid an infinite loop.
|
|
beaa14a4
|
2010-04-21T22:01:59
|
|
Move domain search state to evdns_request.
It doesn't seem to make sense to copy the state to each new request
in the search.
|
|
15bb82d6
|
2010-04-21T21:21:21
|
|
Ensure that evdns_request is a persistent handle.
When searching is enabled, evdns may make multiple requests before
calling the user callback with the result. This is a problem because
the same evdns_request handle is not retained for each search request,
so the user cannot reliably cancel the request.
This patch attempts to ensure that evdns_request persists accross
search requests.
|
|
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)
|
|
859af677
|
2010-03-13T00:53:54
|
|
Free evdns_base->req_heads on evdns_base_free
It looks like when we moved from one big inflight-requests list to an
n-heads structure, we didn't make evdns_base_free() free the array of
heads. This patch should fix that.
Found with valgrind
|
|
b2f2be6e
|
2010-03-10T16:25:16
|
|
Make evdns use the regular logging system by default
Once, for reasons that made sense at the time, we had evdns.c use its
own logging subsystem with two levels, "warn" and "debug". This leads
to problems, since setting a log handler for Libevent wouldn't actually
trap these messages, since they weren't on by default, and since some of
the warns should really be msgs.
This patch changes the default behavior of evdns.c to log to
event_(debugx,warnx,msgx) by default, and adds a new (internal-use-only)
log level of EVDNS_LOG_MSG. Programs that set a evdns logging
function will see no change. Programs that don't will now see evdns
warnings reported like other warnings.
|
|
2c2618d8
|
2010-03-05T13:00:15
|
|
more whitespace normalization
|
|
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.
|
|
1dd7e6dc
|
2010-02-05T01:16:23
|
|
Remove the 'flags' argument from evdns_base_set_option()
The 'flags' argument made sense when passed to
evdns_(base_)?parse_resolv_conf when it said which parts of the
resolv.conf file to obey. But for evdns_set_option(), it was really
silly, since you wouldn't be calling evdns_set_option() unless you
actually wanted to set the option. Its meaning was basically, "set
this to DNS_OPTIONS_ALL unless you want a funny surprise."
evdns_base_set_option was new in 2.0.1-alpha, so we aren't committed
to keeping it source-compatible.
|
|
a7a94310
|
2010-02-03T23:49:22
|
|
Fix some additional -DUNICODE issues on win32.
Brodie's patch didn't catch the ones that were new since 1.4.
|
|
000a33ec
|
2010-02-03T23:27:40
|
|
Make Libevent 1.4.12 build on win32 with Unicode enabled.
This patch fixes calls to the win32 api to explicitly call the char* versions
of the functions. This fixes build failures when libevent is built with the
UNICODE define.
|
|
da6135e3
|
2010-02-03T02:09:19
|
|
Reduce windows header includes in our own headers.
It turns out that absolutely everything that was including
windows.h was doing so needlessly; our headers don't need it,
so we should just include winsock2.h (since that's where
struct timeval is defined).
Pre-2.0 code will use the old headers, which include windows.h
for them, so we aren't breaking source compatibility with 1.4.
This solves the bug where we were leaving WIN32_LEAN_AND_MEAN
defined, in roughly the same way that buying an automobile
solves the question of what to give your coachman for boxing
day.
|
|
439aea0d
|
2010-01-25T14:07:01
|
|
Try to untangle the logic in server_port_flush().
The logic that prevented the first loop in this function from being
infinite was rather confusing and hard to follow. It seems to confuse
some automatic analysis tools as well as me. Let's try to replace it
with something more comprehensible.
|
|
a19b4a05
|
2010-01-25T13:38:07
|
|
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.
|
|
e2ca403f
|
2010-01-23T16:23:45
|
|
Make it compile under gcc --std=c89.
|
|
ff3f6cd4
|
2010-01-22T16:14:49
|
|
Check more internal event_add() calls for failure
Most of these should be unable to fail, since adding a timeout
generally always works. Still, it's better not to try to be "too
smart for our own good here."
There are some remaining event_add() calls that I didn't add checks
for; I've marked those with "XXXX" comments.
|
|
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.
|
|
66c02c78
|
2010-01-08T04:02:19
|
|
Look at the proper /etc/hosts file on windows.
This is harder than it might initially seem, since the proper filename
depends on what the admin has decided to call the windows system directory,
which for all we know might be Q:\tralfamidore\slartibartfast. And of course,
this being windows, there are twelve ways to do it, where you can pick a
nice one or a portable one, but not a really nice portable one.
|
|
72dd6667
|
2009-12-07T17:21:41
|
|
evdns_getaddrinfo() now supports the /etc/hosts file.
The regular blocking evutil_getaddrinfo() already supported /etc/hosts
by falling back to getaddrinfo() or gethostbyname(). But
evdns_getaddrinfo() had no such facility. Now it does.
The data structure here isn't very clever. I guess people with huge
/etc/hosts files will either need to get out of the 1980s, or submit a
patch to this code so that it uses a hashtable instead of a linked
list.
Includes basic unit tests.
|
|
0546ce11
|
2009-12-30T05:03:54
|
|
Eradicated the last free() call. Let mm_free() take care of deallocation.
|
|
1e56a32d
|
2009-12-29T16:04:16
|
|
Make the initial nameserver probe timeout configurable.
When we decide that a nameserver is down, we stop sending queries to
it, except to periodically probe it to see if it has come back up.
Our previous probe sechedule was an ad-hoc and hard-wired "10 seconds,
one minute, 5 minues, 15 minutes, 1 hour, 1 hour, 1 hour...". There
was nothing wrong with having it be ad-hoc, but making it hard-wired
served no good purpose.
Now the user can set the initial timeout via a new
"initial-probe-timeout:" option; future timeouts back off by a factor
of 3 on every failure to a maximum of 1 hour.
As a side-benefit, this lets us cut the runtime of the dns/retry test
from about 40 seconds to about 3 seconds. Faster unit tests are
always a good thing.
|
|
ee4953f8
|
2009-12-29T16:03:30
|
|
Fix the code that allowed DNS options to not end with :
We tried to fix this in 0.2.0.3-alpha, but our fix was buggy.
|
|
c51bb3c3
|
2009-12-21T16:36:40
|
|
Fix a few locking issues on windows.
|
|
2b7abf03
|
2009-12-04T13:49:27
|
|
Merge commit 'niels/dnscrash'
|
|
6c7c5799
|
2009-12-04T10:44:46
|
|
Fix a crash when reading badly formatted resolve.conf; from Yasuoka Masahiko
|
|
0cd3bb9f
|
2009-11-27T17:22:19
|
|
Improved optional lock debugging.
There were a couple of places in the code where we manually kept lock
counts to make sure we never accessed resources without holding a
lock, and that we never released a lock we didn't have. The
lock-debugging code already puts counts on _every_ lock when lock
debugging is enabled, so there is no need to keep these counts around
otherwise. This patch rewrites the ASSERT_FOO_LOCKED macros to all
use a common EVLOCK_ASSERT_LOCKED().
We also teach the lock debugging code to keep track of who exactly
holds each lock, so that EVLOCK_ASSERT_LOCKED() means "locked by this
thread."
|
|
2df1f82b
|
2009-11-27T16:02:49
|
|
Fix an evdns lock violation.
Original message:
evdns contains a bug related to thread lock.
enable thread lock by evthread_use_pthreads() will cause successive
evdns_base_resolve_ipv4() (and other resolve functions i think) to
hang on EVDNS_LOCK(base) after one or several successful call to
evdns_base_resolve_ipv4().
|
|
76cd2b70
|
2009-11-27T16:44:47
|
|
Stop passing EVTHREAD_READ and EVTHREAD_WRITE to non-rw locks.
Previously, our default lock model kind of assumed that every lock was
potentially a read-write lock. This was a poor choice, since
read-write locks are far more expensive than regular locks, and so the
lock API should only use them when we can actually take advantage of
them. Neither our pthreads or win32 lock implementation provided rw
locks.
Now that we have a way (not currently used!) to indicate that we
really want a read-write lock, we shouldn't actually say "lock this
for reading" or "lock this for writing" unless we mean it.
|
|
347952ff
|
2009-11-27T15:20:43
|
|
Revise the locking API: deprecate the old locking callbacks and add trylock.
Previously, there was no good way to request different kinds of lock
(say, read/write vs writeonly or recursive vs nonrecursive), or for a
lock function to signal failure (which would be important for a
trylock mode).
This patch revises the lock API to be a bit more useful. The older
lock calls are still supported for now.
We also add a debugging mode to catch common errors in using the
locking APIs.
|
|
91fe23fc
|
2009-11-20T15:46:04
|
|
Tolerate code that returns from a fatal_cb.
Also, replace more abort() calls with EVUTIL_ASSERT() or event_errx.
|
|
767eb70f
|
2009-11-18T21:16:33
|
|
Fix compilation with threading disabled.
svn:r1546
|
|
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
|
|
72bafc17
|
2009-11-16T22:23:55
|
|
Remove the stupid brokenness where DNS option names needed to end with a
colon.
svn:r1536
|
|
18a8cfac
|
2009-11-15T19:00:12
|
|
Prefer calloc(a,b) to malloc(a*b). via openbsd.
svn:r1531
|
|
e2b2de79
|
2009-11-15T18:59:48
|
|
Use arc4random() for dns transaction ids where available. Patch taken from OpenBSD
svn:r1528
|
|
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
|
|
d2e7e65d
|
2009-11-05T22:19:09
|
|
Move the evdns sample code into the sample directory and fix it not to use any deprecated APIs.
svn:r1511
|
|
25a5e681
|
2009-11-05T20:37:19
|
|
Build fixes for MSVC
svn:r1506
|
|
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
|
|
2e36dbe1
|
2009-10-26T20:00:43
|
|
Use EVUTIL_ASSERT() consistently instead of assert.
svn:r1464
|
|
e3fd294a
|
2009-10-16T13:19:57
|
|
Spelling fixes in comments and strings.
svn:r1445
|
|
fc83ca3c
|
2009-10-14T00:46:40
|
|
Fix some crash bugs when initializing evdns
svn:r1443
|
|
213dc2a2
|
2009-08-03T20:15:32
|
|
Fix an annoying evdns crash bug, and add more unit tests for evdns.
svn:r1406
|
|
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
|
|
5b5b880b
|
2009-07-28T19:41:39
|
|
Various MSVC cleanups from Brodie Thiesfield.
svn:r1385
|
|
12199fa7
|
2009-07-28T17:11:03
|
|
Fix segfault during failed allocatino of locked evdns base.
We need to comb the rest of the code to make sure that we don't blindly wrap
functions in LOCK(x), UNLOCK(x) when those functions might contain a FREE(x)
in the middle.
Rocco Carbone found and reported this bug.
svn:r1384
|
|
b06b2649
|
2009-07-26T01:29:39
|
|
Make "deferred callback queue" independent of event_base.
This way, we can more easily have an IOCP bufferevent implementation
that does not need an event_base at all. Woot.
svn:r1381
|
|
670658eb
|
2009-07-21T18:32:57
|
|
Correct the signatures for evdns_configure_windows_nameservers(), now that it is exposed.
svn:r1369
|
|
e83a32df
|
2009-07-14T19:31:20
|
|
Do not define _FORTIFY_SOURCE if the platform GCC already defined it for us.
svn:r1346
|
|
342ad355
|
2009-06-30T14:23:18
|
|
The truncated bit is in the 3rd byte of a dns reply, not the 4th. [fwd-port]
svn:r1332
|
|
f901f986
|
2009-06-24T22:40:15
|
|
When our IP address changes, do not break all existing dns server sockets. Patch from Christopher Davis
svn:r1329
|
|
7289d7f8
|
2009-05-22T18:20:59
|
|
Fix a potentially very annoying evdns bug that we found in Tor.
Generally speaking, it way better to event_assign() an event when you
allocate it than to assign it before every time you event_add it: if
it is already event_add()ed, the assign will mess it up so that it
doesn't _look_ added, and event_add() will insert a second copy.
Later, event_del() will only delete the second copy. Eventually, the
event_base will have a dangling pointer to freed memory. Ouch!
svn:r1307
|
|
f11dff2c
|
2009-05-07T03:45:51
|
|
Add and use locale-independent strcasecmp functions.
svn:r1280
|
|
7b24d72a
|
2009-05-02T16:22:55
|
|
Remove some duplicated includes in evdns.c
svn:r1265
|
|
e865eb93
|
2009-05-01T00:54:14
|
|
More msvc build tweaks.
svn:r1262
|
|
1ad03264
|
2009-04-23T18:04:50
|
|
Fix win32 compilation issues.
svn:r1234
|
|
9516df0e
|
2009-04-23T05:40:06
|
|
Fix c89 bugs reported by Cory Stup.
Others may remain. I wasn't able to get gcc --std=c89 to build libevent
at all, so I don't know what compiler the original reporter is using here.
Note that this change requires us to disable the part of our rpc code
that uses variadic macros when using a non-gcc compiler. This is a
problem if we want our rpc api to be portable.
svn:r1231
|
|
2d9619d7
|
2009-04-19T01:59:09
|
|
Make dns callbacks run deferred
svn:r1205
|
|
327165b3
|
2009-04-19T01:58:54
|
|
Add locks to evdns.
svn:r1204
|
|
ac3fc991
|
2009-04-19T01:58:41
|
|
Use new-style headers in evdns.c
svn:r1203
|
|
684c022a
|
2009-04-06T20:38:42
|
|
Avoid a double event_del() in evdns.c.
The bug could occur when a nameserver was marked as up, but then an
outstanding probe sent to the nameserver failed. Now, evdns_up() cancels
any outstanding probe.
svn:r1140
|
|
d2e9caa6
|
2009-04-06T20:38:19
|
|
Fix evdns_cancel to alert callback and free associated RAM.
Also, we add a test to make sure evdns_cancel is working properly.
svn:r1139
|
|
0f3c0983
|
2009-04-05T17:50:18
|
|
Fix a double-delete on the request timeout event. Port from Tor.
svn:r1138
|
|
d0a9c90e
|
2009-02-11T17:29:17
|
|
Fix some of the crazier indentation and tabbing choices in evdns.c
svn:r1120
|
|
77c80b8d
|
2009-02-11T17:24:11
|
|
New bind-to option to allow DNS clients to bind to arbitrary ports for their outgoing addresses.
svn:r1119
|
|
acaf65c3
|
2009-02-11T17:23:32
|
|
Make evutil_parse_sockaddr_port give a useful socket-length output.
svn:r1118
|
|
f2a24d6e
|
2009-02-11T17:22:40
|
|
Better comments for some confusing-to-me code.
svn:r1117
|
|
c6f4dc98
|
2009-02-11T17:21:48
|
|
Port some evdns changes over from Tor.
svn:r1116
|