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

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

Issue 23785015: Revert 224681 "Revert 195406 "[net/dns] Test IPv6 support via UD..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1599/src/
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after
2016 } 2016 }
2017 } 2017 }
2018 2018
2019 HostResolverImpl::Key HostResolverImpl::GetEffectiveKeyForRequest( 2019 HostResolverImpl::Key HostResolverImpl::GetEffectiveKeyForRequest(
2020 const RequestInfo& info, const BoundNetLog& net_log) const { 2020 const RequestInfo& info, const BoundNetLog& net_log) const {
2021 HostResolverFlags effective_flags = 2021 HostResolverFlags effective_flags =
2022 info.host_resolver_flags() | additional_resolver_flags_; 2022 info.host_resolver_flags() | additional_resolver_flags_;
2023 AddressFamily effective_address_family = info.address_family(); 2023 AddressFamily effective_address_family = info.address_family();
2024 2024
2025 if (info.address_family() == ADDRESS_FAMILY_UNSPECIFIED) { 2025 if (info.address_family() == ADDRESS_FAMILY_UNSPECIFIED) {
2026 base::TimeTicks start_time = base::TimeTicks::Now(); 2026 if (probe_ipv6_support_) {
2027 // Google DNS address. 2027 base::TimeTicks start_time = base::TimeTicks::Now();
2028 const uint8 kIPv6Address[] = 2028 // Google DNS address.
2029 { 0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, 2029 const uint8 kIPv6Address[] =
2030 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88 }; 2030 { 0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00,
2031 IPAddressNumber address(kIPv6Address, 2031 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88 };
2032 kIPv6Address + arraysize(kIPv6Address)); 2032 IPAddressNumber address(kIPv6Address,
2033 bool rv6 = IsGloballyReachable(address, net_log); 2033 kIPv6Address + arraysize(kIPv6Address));
2034 bool rv6 = IsGloballyReachable(address, net_log);
2035 if (rv6)
2036 net_log.AddEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_IPV6_SUPPORTED);
2034 2037
2035 UMA_HISTOGRAM_TIMES("Net.IPv6ConnectDuration", 2038 UMA_HISTOGRAM_TIMES("Net.IPv6ConnectDuration",
2036 base::TimeTicks::Now() - start_time); 2039 base::TimeTicks::Now() - start_time);
2037 if (rv6) { 2040 if (rv6) {
2038 UMA_HISTOGRAM_BOOLEAN("Net.IPv6ConnectSuccessMatch", 2041 UMA_HISTOGRAM_BOOLEAN("Net.IPv6ConnectSuccessMatch",
2039 default_address_family_ == ADDRESS_FAMILY_UNSPECIFIED); 2042 default_address_family_ == ADDRESS_FAMILY_UNSPECIFIED);
2043 } else {
2044 UMA_HISTOGRAM_BOOLEAN("Net.IPv6ConnectFailureMatch",
2045 default_address_family_ != ADDRESS_FAMILY_UNSPECIFIED);
2046
2047 effective_address_family = ADDRESS_FAMILY_IPV4;
2048 effective_flags |= HOST_RESOLVER_DEFAULT_FAMILY_SET_DUE_TO_NO_IPV6;
2049 }
2040 } else { 2050 } else {
2041 UMA_HISTOGRAM_BOOLEAN("Net.IPv6ConnectFailureMatch", 2051 effective_address_family = default_address_family_;
2042 default_address_family_ != ADDRESS_FAMILY_UNSPECIFIED);
2043 } 2052 }
2044 } 2053 }
2045 2054
2046 if (effective_address_family == ADDRESS_FAMILY_UNSPECIFIED &&
2047 default_address_family_ != ADDRESS_FAMILY_UNSPECIFIED) {
2048 effective_address_family = default_address_family_;
2049 if (ipv6_probe_monitoring_)
2050 effective_flags |= HOST_RESOLVER_DEFAULT_FAMILY_SET_DUE_TO_NO_IPV6;
2051 }
2052
2053 return Key(info.hostname(), effective_address_family, effective_flags); 2055 return Key(info.hostname(), effective_address_family, effective_flags);
2054 } 2056 }
2055 2057
2056 void HostResolverImpl::AbortAllInProgressJobs() { 2058 void HostResolverImpl::AbortAllInProgressJobs() {
2057 // In Abort, a Request callback could spawn new Jobs with matching keys, so 2059 // In Abort, a Request callback could spawn new Jobs with matching keys, so
2058 // first collect and remove all running jobs from |jobs_|. 2060 // first collect and remove all running jobs from |jobs_|.
2059 ScopedVector<Job> jobs_to_abort; 2061 ScopedVector<Job> jobs_to_abort;
2060 for (JobMap::iterator it = jobs_.begin(); it != jobs_.end(); ) { 2062 for (JobMap::iterator it = jobs_.begin(); it != jobs_.end(); ) {
2061 Job* job = it->second; 2063 Job* job = it->second;
2062 if (job->is_running()) { 2064 if (job->is_running()) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
2195 } 2197 }
2196 DnsConfig dns_config; 2198 DnsConfig dns_config;
2197 NetworkChangeNotifier::GetDnsConfig(&dns_config); 2199 NetworkChangeNotifier::GetDnsConfig(&dns_config);
2198 dns_client_->SetConfig(dns_config); 2200 dns_client_->SetConfig(dns_config);
2199 num_dns_failures_ = 0; 2201 num_dns_failures_ = 0;
2200 if (dns_config.IsValid()) 2202 if (dns_config.IsValid())
2201 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); 2203 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true);
2202 } 2204 }
2203 2205
2204 } // namespace net 2206 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698