Chromium Code Reviews| 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/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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 675 StartLookupAttempt(); | 675 StartLookupAttempt(); |
| 676 } | 676 } |
| 677 | 677 |
| 678 // Callback for when DoLookup() completes (runs on origin thread). | 678 // Callback for when DoLookup() completes (runs on origin thread). |
| 679 void OnLookupComplete(const AddressList& results, | 679 void OnLookupComplete(const AddressList& results, |
| 680 const base::TimeTicks& start_time, | 680 const base::TimeTicks& start_time, |
| 681 const uint32 attempt_number, | 681 const uint32 attempt_number, |
| 682 int error, | 682 int error, |
| 683 const int os_error) { | 683 const int os_error) { |
| 684 DCHECK(origin_loop_->BelongsToCurrentThread()); | 684 DCHECK(origin_loop_->BelongsToCurrentThread()); |
| 685 DCHECK(error || !results.empty()); | 685 // If results are empty, we should return an error. |
| 686 bool empty_list_on_ok = (error == OK && results.empty()); | |
| 687 UMA_HISTOGRAM_BOOLEAN("DNS.EmptyAddressListAndNoError1", empty_list_on_ok); | |
| 688 if (empty_list_on_ok) | |
| 689 error = ERR_NAME_NOT_RESOLVED; | |
| 686 | 690 |
| 687 bool was_retry_attempt = attempt_number > 1; | 691 bool was_retry_attempt = attempt_number > 1; |
| 688 | 692 |
| 689 // Ideally the following code would be part of host_resolver_proc.cc, | 693 // Ideally the following code would be part of host_resolver_proc.cc, |
| 690 // however it isn't safe to call NetworkChangeNotifier from worker threads. | 694 // however it isn't safe to call NetworkChangeNotifier from worker threads. |
| 691 // So we do it here on the IO thread instead. | 695 // So we do it here on the IO thread instead. |
| 692 if (error != OK && NetworkChangeNotifier::IsOffline()) | 696 if (error != OK && NetworkChangeNotifier::IsOffline()) |
| 693 error = ERR_INTERNET_DISCONNECTED; | 697 error = ERR_INTERNET_DISCONNECTED; |
| 694 | 698 |
| 695 // If this is the first attempt that is finishing later, then record data | 699 // If this is the first attempt that is finishing later, then record data |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1430 resolver_->resolved_known_ipv6_hostname_ = true; | 1434 resolver_->resolved_known_ipv6_hostname_ = true; |
| 1431 bool got_ipv6_address = false; | 1435 bool got_ipv6_address = false; |
| 1432 for (size_t i = 0; i < addr_list.size(); ++i) { | 1436 for (size_t i = 0; i < addr_list.size(); ++i) { |
| 1433 if (addr_list[i].GetFamily() == ADDRESS_FAMILY_IPV6) | 1437 if (addr_list[i].GetFamily() == ADDRESS_FAMILY_IPV6) |
| 1434 got_ipv6_address = true; | 1438 got_ipv6_address = true; |
| 1435 } | 1439 } |
| 1436 UMA_HISTOGRAM_BOOLEAN("Net.UnspecResolvedIPv6", got_ipv6_address); | 1440 UMA_HISTOGRAM_BOOLEAN("Net.UnspecResolvedIPv6", got_ipv6_address); |
| 1437 } | 1441 } |
| 1438 } | 1442 } |
| 1439 | 1443 |
| 1444 bool empty_list_on_ok = (net_error == OK && addr_list.empty()); | |
|
szym
2013/05/06 20:07:02
As I pointed out before, I don't think this can ev
mef
2013/05/07 14:53:40
Done. I left it here because my previous experimen
| |
| 1445 UMA_HISTOGRAM_BOOLEAN("DNS.EmptyAddressListAndNoError2", empty_list_on_ok); | |
| 1446 if (empty_list_on_ok) | |
| 1447 net_error = ERR_NAME_NOT_RESOLVED; | |
| 1448 | |
| 1440 if (dns_task_error_ != OK) { | 1449 if (dns_task_error_ != OK) { |
| 1441 base::TimeDelta duration = base::TimeTicks::Now() - start_time; | 1450 base::TimeDelta duration = base::TimeTicks::Now() - start_time; |
| 1442 if (net_error == OK) { | 1451 if (net_error == OK) { |
| 1443 DNS_HISTOGRAM("AsyncDNS.FallbackSuccess", duration); | 1452 DNS_HISTOGRAM("AsyncDNS.FallbackSuccess", duration); |
| 1444 if ((dns_task_error_ == ERR_NAME_NOT_RESOLVED) && | 1453 if ((dns_task_error_ == ERR_NAME_NOT_RESOLVED) && |
| 1445 ResemblesNetBIOSName(key_.hostname)) { | 1454 ResemblesNetBIOSName(key_.hostname)) { |
| 1446 UmaAsyncDnsResolveStatus(RESOLVE_STATUS_SUSPECT_NETBIOS); | 1455 UmaAsyncDnsResolveStatus(RESOLVE_STATUS_SUSPECT_NETBIOS); |
| 1447 } else { | 1456 } else { |
| 1448 UmaAsyncDnsResolveStatus(RESOLVE_STATUS_PROC_SUCCESS); | 1457 UmaAsyncDnsResolveStatus(RESOLVE_STATUS_PROC_SUCCESS); |
| 1449 } | 1458 } |
| (...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2229 } | 2238 } |
| 2230 DnsConfig dns_config; | 2239 DnsConfig dns_config; |
| 2231 NetworkChangeNotifier::GetDnsConfig(&dns_config); | 2240 NetworkChangeNotifier::GetDnsConfig(&dns_config); |
| 2232 dns_client_->SetConfig(dns_config); | 2241 dns_client_->SetConfig(dns_config); |
| 2233 num_dns_failures_ = 0; | 2242 num_dns_failures_ = 0; |
| 2234 if (dns_config.IsValid()) | 2243 if (dns_config.IsValid()) |
| 2235 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); | 2244 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); |
| 2236 } | 2245 } |
| 2237 | 2246 |
| 2238 } // namespace net | 2247 } // namespace net |
| OLD | NEW |