| OLD | NEW |
| 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/dns_config_service.h" | 5 #include "net/dns/dns_config_service.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "net/base/ip_endpoint.h" | 10 #include "net/base/ip_endpoint.h" |
| 11 | 11 |
| 12 namespace net { | 12 namespace net { |
| 13 | 13 |
| 14 // Default values are taken from glibc resolv.h except timeout which is set to | 14 // Default values are taken from glibc resolv.h except timeout which is set to |
| 15 // |kDnsTimeoutSeconds|. | 15 // |kDnsTimeoutSeconds|. |
| 16 DnsConfig::DnsConfig() | 16 DnsConfig::DnsConfig() |
| 17 : append_to_multi_label_name(true), | 17 : append_to_multi_label_name(true), |
| 18 randomize_ports(true), | 18 randomize_ports(false), |
| 19 ndots(1), | 19 ndots(1), |
| 20 timeout(base::TimeDelta::FromSeconds(kDnsTimeoutSeconds)), | 20 timeout(base::TimeDelta::FromSeconds(kDnsTimeoutSeconds)), |
| 21 attempts(2), | 21 attempts(2), |
| 22 rotate(false), | 22 rotate(false), |
| 23 edns0(false) {} | 23 edns0(false) {} |
| 24 | 24 |
| 25 DnsConfig::~DnsConfig() {} | 25 DnsConfig::~DnsConfig() {} |
| 26 | 26 |
| 27 bool DnsConfig::Equals(const DnsConfig& d) const { | 27 bool DnsConfig::Equals(const DnsConfig& d) const { |
| 28 return EqualsIgnoreHosts(d) && (hosts == d.hosts); | 28 return EqualsIgnoreHosts(d) && (hosts == d.hosts); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 if (watch_failed_) { | 217 if (watch_failed_) { |
| 218 // If a watch failed, the config may not be accurate, so report empty. | 218 // If a watch failed, the config may not be accurate, so report empty. |
| 219 callback_.Run(DnsConfig()); | 219 callback_.Run(DnsConfig()); |
| 220 } else { | 220 } else { |
| 221 callback_.Run(dns_config_); | 221 callback_.Run(dns_config_); |
| 222 } | 222 } |
| 223 } | 223 } |
| 224 | 224 |
| 225 } // namespace net | 225 } // namespace net |
| 226 | 226 |
| OLD | NEW |