diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-02-08 23:05:40 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-02-08 23:05:40 +0900 |
| commit | f0682a98c0c22a9ef1a47e54d19244c9b4b9d208 (patch) | |
| tree | ed674060632036481ccb2a0dd8ef3a68b06b7b70 /src/AsyncNameResolver.cc | |
| parent | cf546810e464e0e53bfe5c6f710f768a5fafcf68 (diff) | |
Added --async-dns-server option.
This option accepts comma separated list of DNS server address used in
asynchronous DNS resolver. Usually asynchronous DNS resolver reads DNS
server addresses from /etc/resolv.conf. When this option is used, it
uses DNS servers specified in this option instead of ones in
/etc/resolv.conf. You can specify both IPv4 and IPv6 address. This
option is useful when the system does not have /etc/resolv.conf and
user does not have the permission to create it.
Diffstat (limited to 'src/AsyncNameResolver.cc')
| -rw-r--r-- | src/AsyncNameResolver.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/AsyncNameResolver.cc b/src/AsyncNameResolver.cc index 7c7d6320..832d8a45 100644 --- a/src/AsyncNameResolver.cc +++ b/src/AsyncNameResolver.cc @@ -37,6 +37,7 @@ #include <cstring> #include "A2STR.h" +#include "LogFactory.h" namespace aria2 { @@ -77,12 +78,18 @@ void callback(void* arg, int status, int timeouts, struct hostent* host) } } -AsyncNameResolver::AsyncNameResolver(int family): +AsyncNameResolver::AsyncNameResolver(int family, ares_addr_node* servers): status_(STATUS_READY), family_(family) { // TODO evaluate return value ares_init(&channel_); + if(servers) { + // ares_set_servers has been added since c-ares 1.7.1 + if(ares_set_servers(channel_, servers) != ARES_SUCCESS) { + A2_LOG_DEBUG("ares_set_servers failed"); + } + } } AsyncNameResolver::~AsyncNameResolver() |
