summaryrefslogtreecommitdiffstats
path: root/net/base
diff options
context:
space:
mode:
authorszym@chromium.org <szym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-13 16:18:14 +0000
committerszym@chromium.org <szym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-13 16:18:14 +0000
commit01b3b9d5148f9b2934d33e5069ae916589179059 (patch)
tree690021e1de61fc8c3bdf4cf37a5afdb3d5a7c15f /net/base
parent6e56662fa931f303c3974b3d07090558a86576c0 (diff)
downloadchromium_src-01b3b9d5148f9b2934d33e5069ae916589179059.zip
chromium_src-01b3b9d5148f9b2934d33e5069ae916589179059.tar.gz
chromium_src-01b3b9d5148f9b2934d33e5069ae916589179059.tar.bz2
[net] Use only DnsConfigService to detect DNS changes in HostResolverImpl
The signals coming currently via DNSObserver are too noisy. DnsConfigService can weed out false positives, so switch to using it exclusively. BUG=142138 TEST=network requests work after network changes Review URL: https://chromiumcodereview.appspot.com/10830271 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151278 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r--net/base/host_resolver_impl.cc49
-rw-r--r--net/base/host_resolver_impl.h4
2 files changed, 19 insertions, 34 deletions
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc
index 9ec0a37..e18a9e5 100644
--- a/net/base/host_resolver_impl.cc
+++ b/net/base/host_resolver_impl.cc
@@ -1602,7 +1602,6 @@ HostResolverImpl::HostResolverImpl(
NetworkChangeNotifier::AddIPAddressObserver(this);
#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
!defined(OS_ANDROID)
- NetworkChangeNotifier::AddDNSObserver(this);
EnsureDnsReloaderInit();
#endif
@@ -1620,7 +1619,6 @@ HostResolverImpl::~HostResolverImpl() {
STLDeleteValues(&jobs_);
NetworkChangeNotifier::RemoveIPAddressObserver(this);
- NetworkChangeNotifier::RemoveDNSObserver(this);
}
void HostResolverImpl::SetMaxQueuedJobs(size_t value) {
@@ -1983,25 +1981,6 @@ void HostResolverImpl::OnIPAddressChanged() {
// |this| may be deleted inside AbortAllInProgressJobs().
}
-void HostResolverImpl::OnDNSChanged(unsigned detail) {
- // Ignore signals about watches.
- const unsigned kIgnoredDetail =
- NetworkChangeNotifier::CHANGE_DNS_WATCH_STARTED |
- NetworkChangeNotifier::CHANGE_DNS_WATCH_FAILED;
- if ((detail & ~kIgnoredDetail) == 0)
- return;
- // If the DNS server has changed, existing cached info could be wrong so we
- // have to drop our internal cache :( Note that OS level DNS caches, such
- // as NSCD's cache should be dropped automatically by the OS when
- // resolv.conf changes so we don't need to do anything to clear that cache.
- if (cache_.get())
- cache_->clear();
- // Existing jobs will have been sent to the original server so they need to
- // be aborted.
- AbortAllInProgressJobs();
- // |this| may be deleted inside AbortAllInProgressJobs().
-}
-
void HostResolverImpl::OnDnsConfigChanged(const DnsConfig& dns_config) {
if (net_log_) {
net_log_->AddGlobalEntry(
@@ -2009,21 +1988,31 @@ void HostResolverImpl::OnDnsConfigChanged(const DnsConfig& dns_config) {
base::Bind(&NetLogDnsConfigCallback, &dns_config));
}
- // TODO(szym): Remove once http://crbug.com/125599 is resolved.
+ // TODO(szym): Remove once http://crbug.com/137914 is resolved.
received_dns_config_ = dns_config.IsValid();
// Life check to bail once |this| is deleted.
base::WeakPtr<HostResolverImpl> self = AsWeakPtr();
- if (dns_client_.get()) {
- // We want a new factory in place, before we Abort running Jobs, so that the
- // newly started jobs use the new factory.
+ // We want a new DnsSession in place, before we Abort running Jobs, so that
+ // the newly started jobs use the new config.
+ if (dns_client_.get())
dns_client_->SetConfig(dns_config);
- OnDNSChanged(NetworkChangeNotifier::CHANGE_DNS_SETTINGS);
- // |this| may be deleted inside OnDNSChanged().
- if (self)
- TryServingAllJobsFromHosts();
- }
+
+ // If the DNS server has changed, existing cached info could be wrong so we
+ // have to drop our internal cache :( Note that OS level DNS caches, such
+ // as NSCD's cache should be dropped automatically by the OS when
+ // resolv.conf changes so we don't need to do anything to clear that cache.
+ if (cache_.get())
+ cache_->clear();
+
+ // Existing jobs will have been sent to the original server so they need to
+ // be aborted.
+ AbortAllInProgressJobs();
+
+ // |this| may be deleted inside AbortAllInProgressJobs().
+ if (self)
+ TryServingAllJobsFromHosts();
}
bool HostResolverImpl::HaveDnsConfig() const {
diff --git a/net/base/host_resolver_impl.h b/net/base/host_resolver_impl.h
index 8c2579d..3c1b5d2 100644
--- a/net/base/host_resolver_impl.h
+++ b/net/base/host_resolver_impl.h
@@ -59,7 +59,6 @@ class NET_EXPORT HostResolverImpl
: public HostResolver,
NON_EXPORTED_BASE(public base::NonThreadSafe),
public NetworkChangeNotifier::IPAddressObserver,
- public NetworkChangeNotifier::DNSObserver,
public base::SupportsWeakPtr<HostResolverImpl> {
public:
// Parameters for ProcTask which resolves hostnames using HostResolveProc.
@@ -219,9 +218,6 @@ class NET_EXPORT HostResolverImpl
// NetworkChangeNotifier::IPAddressObserver:
virtual void OnIPAddressChanged() OVERRIDE;
- // NetworkChangeNotifier::DNSObserver:
- virtual void OnDNSChanged(unsigned detail) OVERRIDE;
-
// DnsConfigService callback:
void OnDnsConfigChanged(const DnsConfig& dns_config);