diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-05 23:40:51 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-05 23:40:51 +0000 |
commit | e1439025774175eccdef9ef61d680fbed1207c1a (patch) | |
tree | 02702fdab70a14a34add1e0f8c24669217cdd727 /net/base/host_resolver_proc.cc | |
parent | c3b33fae9fb7a278e3fc472646a24034514d01b1 (diff) | |
download | chromium_src-e1439025774175eccdef9ef61d680fbed1207c1a.zip chromium_src-e1439025774175eccdef9ef61d680fbed1207c1a.tar.gz chromium_src-e1439025774175eccdef9ef61d680fbed1207c1a.tar.bz2 |
Revert 99666 (sync tests started failing on mac10.6:
http://build.chromium.org/p/chromium/builders/Mac10.6%20Sync/builds/9198
- Linux: Monitor resolv.conf for changes and use that to reload resolver.
BUG=67734
TEST=manual testing by poking at resolv.conf
Review URL: http://codereview.chromium.org/6903061
TBR=craig.schlenter@chromium.org
Review URL: http://codereview.chromium.org/7833030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99677 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/host_resolver_proc.cc')
-rw-r--r-- | net/base/host_resolver_proc.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/net/base/host_resolver_proc.cc b/net/base/host_resolver_proc.cc index 331675a..755f119 100644 --- a/net/base/host_resolver_proc.cc +++ b/net/base/host_resolver_proc.cc @@ -8,7 +8,7 @@ #include "base/logging.h" #include "net/base/address_list.h" -#include "net/base/dns_reloader.h" +#include "net/base/dns_reload_timer.h" #include "net/base/net_errors.h" #include "net/base/sys_addrinfo.h" @@ -183,12 +183,22 @@ int SystemHostResolverProc(const std::string& host, // Restrict result set to only this socket type to avoid duplicates. hints.ai_socktype = SOCK_STREAM; + int err = getaddrinfo(host.c_str(), NULL, &hints, &ai); + bool should_retry = false; #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \ !defined(OS_ANDROID) - DnsReloaderMaybeReload(); + // If we fail, re-initialise the resolver just in case there have been any + // changes to /etc/resolv.conf and retry. See http://crbug.com/11380 for info. + if (err && DnsReloadTimerHasExpired()) { + // When there's no network connection, _res may not be initialized by + // getaddrinfo. Therefore, we call res_nclose only when there are ns + // entries. + if (_res.nscount > 0) + res_nclose(&_res); + if (!res_ninit(&_res)) + should_retry = true; + } #endif - int err = getaddrinfo(host.c_str(), NULL, &hints, &ai); - bool should_retry = false; // If the lookup was restricted (either by address family, or address // detection), and the results where all localhost of a single family, // maybe we should retry. There were several bugs related to these |