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

Unified Diff: net/dns/dns_config_service.cc

Issue 9721002: [net/dns] Removes locking from DnsConfigServiceWin and adds local computer name. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Move lowercasing to ServeFromHosts, add test. Reorganize OnHostsRead. Created 8 years, 9 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/dns/dns_config_service.h ('k') | net/dns/dns_config_service_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/dns_config_service.cc
diff --git a/net/dns/dns_config_service.cc b/net/dns/dns_config_service.cc
index be48d2a41d8e631f2cebb038ff34691a6ec590fd..bd42b64254d4126c0832cf503e5612ea3ff3544f 100644
--- a/net/dns/dns_config_service.cc
+++ b/net/dns/dns_config_service.cc
@@ -100,7 +100,18 @@ void DnsConfigService::OnHostsRead(const DnsHosts& hosts) {
void DnsConfigService::StartTimer() {
DCHECK(CalledOnValidThread());
timer_.Stop();
+
+ // Give it a short timeout to come up with a valid config. Otherwise withdraw
+ // the config from the receiver. The goal is to avoid perceivable network
+ // outage (when using the wrong config) but at the same time avoid
+ // unnecessary Job aborts in HostResolverImpl. The signals come from multiple
+ // sources so it might receive multiple events during a config change.
+
+ // DHCP and user-induced changes are on the order of seconds, so 100ms should
+ // not add perceivable delay. On the other hand, config readers should finish
+ // within 100ms with the rare exception of I/O block or extra large HOSTS.
const base::TimeDelta kTimeout = base::TimeDelta::FromMilliseconds(100);
+
timer_.Start(FROM_HERE,
kTimeout,
this,
@@ -112,6 +123,7 @@ void DnsConfigService::OnTimeout() {
// Indicate that even if there is no change in On*Read, we will need to
// update the receiver when the config becomes complete.
need_update_ = true;
+ // Empty config is considered invalid.
callback_.Run(DnsConfig());
}
« no previous file with comments | « net/dns/dns_config_service.h ('k') | net/dns/dns_config_service_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698