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

Side by Side Diff: net/dns/host_resolver_impl.cc

Issue 2785563002: Expire but don't clear HostCache on DNS config change (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « net/base/network_change_notifier.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/dns/host_resolver_impl.h" 5 #include "net/dns/host_resolver_impl.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <Winsock2.h> 8 #include <Winsock2.h>
9 #elif defined(OS_POSIX) 9 #elif defined(OS_POSIX)
10 #include <netdb.h> 10 #include <netdb.h>
(...skipping 2573 matching lines...) Expand 10 before | Expand all | Expand 10 after
2584 if (dns_client_->GetConfig()) { 2584 if (dns_client_->GetConfig()) {
2585 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); 2585 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true);
2586 // If we just switched DnsClients, restart jobs using new resolver. 2586 // If we just switched DnsClients, restart jobs using new resolver.
2587 // TODO(pauljensen): Is this necessary? 2587 // TODO(pauljensen): Is this necessary?
2588 config_changed = true; 2588 config_changed = true;
2589 } 2589 }
2590 } 2590 }
2591 2591
2592 if (config_changed) { 2592 if (config_changed) {
2593 // If the DNS server has changed, existing cached info could be wrong so we 2593 // If the DNS server has changed, existing cached info could be wrong so we
2594 // have to drop our internal cache :( Note that OS level DNS caches, such 2594 // have to expire our internal cache :( Note that OS level DNS caches, such
2595 // as NSCD's cache should be dropped automatically by the OS when 2595 // as NSCD's cache should be dropped automatically by the OS when
2596 // resolv.conf changes so we don't need to do anything to clear that cache. 2596 // resolv.conf changes so we don't need to do anything to clear that cache.
2597 if (cache_.get()) { 2597 if (cache_.get()) {
2598 cache_->clear(); 2598 cache_->OnNetworkChange();
2599 cache_hit_callbacks_.clear(); 2599 cache_hit_callbacks_.clear();
2600 } 2600 }
2601 2601
2602 // Life check to bail once |this| is deleted. 2602 // Life check to bail once |this| is deleted.
2603 base::WeakPtr<HostResolverImpl> self = weak_ptr_factory_.GetWeakPtr(); 2603 base::WeakPtr<HostResolverImpl> self = weak_ptr_factory_.GetWeakPtr();
2604 2604
2605 // Existing jobs will have been sent to the original server so they need to 2605 // Existing jobs will have been sent to the original server so they need to
2606 // be aborted. 2606 // be aborted.
2607 AbortAllInProgressJobs(); 2607 AbortAllInProgressJobs();
2608 2608
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2716 if (job_) 2716 if (job_)
2717 job_->CancelRequest(this); 2717 job_->CancelRequest(this);
2718 } 2718 }
2719 2719
2720 void HostResolverImpl::RequestImpl::ChangeRequestPriority( 2720 void HostResolverImpl::RequestImpl::ChangeRequestPriority(
2721 RequestPriority priority) { 2721 RequestPriority priority) {
2722 job_->ChangeRequestPriority(this, priority); 2722 job_->ChangeRequestPriority(this, priority);
2723 } 2723 }
2724 2724
2725 } // namespace net 2725 } // namespace net
OLDNEW
« no previous file with comments | « net/base/network_change_notifier.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698