| 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 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <Winsock2.h> | 10 #include <Winsock2.h> |
| (...skipping 2074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2085 bool HostResolverImpl::ResolveAsIP(const Key& key, | 2085 bool HostResolverImpl::ResolveAsIP(const Key& key, |
| 2086 const RequestInfo& info, | 2086 const RequestInfo& info, |
| 2087 const IPAddressNumber* ip_number, | 2087 const IPAddressNumber* ip_number, |
| 2088 int* net_error, | 2088 int* net_error, |
| 2089 AddressList* addresses) { | 2089 AddressList* addresses) { |
| 2090 DCHECK(addresses); | 2090 DCHECK(addresses); |
| 2091 DCHECK(net_error); | 2091 DCHECK(net_error); |
| 2092 if (ip_number == nullptr) | 2092 if (ip_number == nullptr) |
| 2093 return false; | 2093 return false; |
| 2094 | 2094 |
| 2095 DCHECK_EQ(key.host_resolver_flags & | |
| 2096 ~(HOST_RESOLVER_CANONNAME | HOST_RESOLVER_LOOPBACK_ONLY | | |
| 2097 HOST_RESOLVER_DEFAULT_FAMILY_SET_DUE_TO_NO_IPV6), | |
| 2098 0) << " Unhandled flag"; | |
| 2099 | |
| 2100 *net_error = OK; | 2095 *net_error = OK; |
| 2101 AddressFamily family = GetAddressFamily(*ip_number); | 2096 AddressFamily family = GetAddressFamily(*ip_number); |
| 2102 if (key.address_family != ADDRESS_FAMILY_UNSPECIFIED && | 2097 if (key.address_family != ADDRESS_FAMILY_UNSPECIFIED && |
| 2103 key.address_family != family) { | 2098 key.address_family != family) { |
| 2104 // Don't return IPv6 addresses for IPv4 queries, and vice versa. | 2099 // Don't return IPv6 addresses for IPv4 queries, and vice versa. |
| 2105 *net_error = ERR_NAME_NOT_RESOLVED; | 2100 *net_error = ERR_NAME_NOT_RESOLVED; |
| 2106 } else { | 2101 } else { |
| 2107 *addresses = AddressList::CreateFromIPAddress(*ip_number, info.port()); | 2102 *addresses = AddressList::CreateFromIPAddress(*ip_number, info.port()); |
| 2108 if (key.host_resolver_flags & HOST_RESOLVER_CANONNAME) | 2103 if (key.host_resolver_flags & HOST_RESOLVER_CANONNAME) |
| 2109 addresses->SetDefaultCanonicalName(); | 2104 addresses->SetDefaultCanonicalName(); |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2458 dns_client_->SetConfig(dns_config); | 2453 dns_client_->SetConfig(dns_config); |
| 2459 num_dns_failures_ = 0; | 2454 num_dns_failures_ = 0; |
| 2460 if (dns_client_->GetConfig()) | 2455 if (dns_client_->GetConfig()) |
| 2461 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); | 2456 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); |
| 2462 } | 2457 } |
| 2463 | 2458 |
| 2464 AbortDnsTasks(); | 2459 AbortDnsTasks(); |
| 2465 } | 2460 } |
| 2466 | 2461 |
| 2467 } // namespace net | 2462 } // namespace net |
| OLD | NEW |