Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(542)

Unified Diff: net/base/host_resolver_impl.cc

Issue 7737034: Revert 99677 (didn't help) - Revert 99666 (sync tests started failing on mac10.6: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/host_resolver_impl.h ('k') | net/base/host_resolver_proc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/host_resolver_impl.cc
===================================================================
--- net/base/host_resolver_impl.cc (revision 99692)
+++ net/base/host_resolver_impl.cc (working copy)
@@ -30,6 +30,7 @@
#include "base/values.h"
#include "net/base/address_list.h"
#include "net/base/address_list_net_log_param.h"
+#include "net/base/dns_reloader.h"
#include "net/base/host_port_pair.h"
#include "net/base/host_resolver_proc.h"
#include "net/base/net_errors.h"
@@ -1090,6 +1091,10 @@
additional_resolver_flags_ |= HOST_RESOLVER_LOOPBACK_ONLY;
#endif
NetworkChangeNotifier::AddIPAddressObserver(this);
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
+ EnsureDnsReloaderInit();
+ NetworkChangeNotifier::AddDNSObserver(this);
+#endif
}
HostResolverImpl::~HostResolverImpl() {
@@ -1104,6 +1109,9 @@
cur_completing_job_->Cancel();
NetworkChangeNotifier::RemoveIPAddressObserver(this);
+#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
+ NetworkChangeNotifier::RemoveDNSObserver(this);
+#endif
// Delete the job pools.
for (size_t i = 0u; i < arraysize(job_pools_); ++i)
@@ -1644,4 +1652,17 @@
// |this| may be deleted inside AbortAllInProgressJobs().
}
+void HostResolverImpl::OnDNSChanged() {
+ // 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. TODO(Craig): Should these jobs be restarted?
+ AbortAllInProgressJobs();
+ // |this| may be deleted inside AbortAllInProgressJobs().
+}
+
} // namespace net
« no previous file with comments | « net/base/host_resolver_impl.h ('k') | net/base/host_resolver_proc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698