Commit 668e8441 authored by Miriam Gershenson's avatar Miriam Gershenson Committed by Commit Bot

Fix bad DCHECK when reading DNS config

The original version of this DCHECK missed a case. It's possible for
SetDnsClient() to run after NetworkChangeNotifier::SetInitialDnsConfig()
but before the task it posts to DNSObservers. When that happens,
DnsClient will already have a valid DnsConfig by the time
UpdateDNSConfig() runs. NetworkChangeNotifier's DNSConfig can't have
changed again since then because there are too many PostTasks in the
way.

Bug: 779144
Cq-Include-Trybots: master.tryserver.chromium.android:android_cronet_tester;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I9acafc463b9ee9dbcc7c7c08da32d1d86901f105
Reviewed-on: https://chromium-review.googlesource.com/747503Reviewed-by: default avatarJulia Tuttle <juliatuttle@chromium.org>
Commit-Queue: Miriam Gershenson <mgersh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512940}
parent bcdcbc98
...@@ -2490,8 +2490,9 @@ void HostResolverImpl::UpdateDNSConfig(bool config_changed) { ...@@ -2490,8 +2490,9 @@ void HostResolverImpl::UpdateDNSConfig(bool config_changed) {
// the newly started jobs use the new config. // the newly started jobs use the new config.
if (dns_client_.get()) { if (dns_client_.get()) {
// Make sure that if the update is an initial read, not a change, there // Make sure that if the update is an initial read, not a change, there
// wasn't already a DnsConfig. // wasn't already a DnsConfig or it's the same one.
DCHECK(config_changed || !dns_client_->GetConfig()); DCHECK(config_changed || !dns_client_->GetConfig() ||
dns_client_->GetConfig()->Equals(dns_config));
dns_client_->SetConfig(dns_config); dns_client_->SetConfig(dns_config);
if (dns_client_->GetConfig()) if (dns_client_->GetConfig())
UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment