| 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/base/host_resolver_proc.h" | 5 #include "net/base/host_resolver_proc.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/sys_byteorder.h" | 10 #include "base/sys_byteorder.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 NOTREACHED(); | 49 NOTREACHED(); |
| 50 return false; | 50 return false; |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| 54 return saw_v4_localhost != saw_v6_localhost; | 54 return saw_v4_localhost != saw_v6_localhost; |
| 55 } | 55 } |
| 56 | 56 |
| 57 } // namespace | 57 } // namespace |
| 58 | 58 |
| 59 void SetPortOnAddressList(uint16 port, AddressList* list) { |
| 60 DCHECK(list); |
| 61 for (AddressList::iterator it = list->begin(); it != list->end(); ++it) { |
| 62 *it = IPEndPoint(it->address(), port); |
| 63 } |
| 64 } |
| 65 |
| 66 void EnsurePortOnAddressList(uint16 port, AddressList* list) { |
| 67 DCHECK(list); |
| 68 if (list->empty() || list->front().port() == port) |
| 69 return; |
| 70 SetPortOnAddressList(port, list); |
| 71 } |
| 72 |
| 59 HostResolverProc* HostResolverProc::default_proc_ = NULL; | 73 HostResolverProc* HostResolverProc::default_proc_ = NULL; |
| 60 | 74 |
| 61 HostResolverProc::HostResolverProc(HostResolverProc* previous) { | 75 HostResolverProc::HostResolverProc(HostResolverProc* previous) { |
| 62 SetPreviousProc(previous); | 76 SetPreviousProc(previous); |
| 63 | 77 |
| 64 // Implicitly fall-back to the global default procedure. | 78 // Implicitly fall-back to the global default procedure. |
| 65 if (!previous) | 79 if (!previous) |
| 66 SetPreviousProc(default_proc_); | 80 SetPreviousProc(default_proc_); |
| 67 } | 81 } |
| 68 | 82 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 if (err != WSAHOST_NOT_FOUND && err != WSANO_DATA) | 243 if (err != WSAHOST_NOT_FOUND && err != WSANO_DATA) |
| 230 return ERR_NAME_RESOLUTION_FAILED; | 244 return ERR_NAME_RESOLUTION_FAILED; |
| 231 #elif defined(OS_POSIX) && !defined(OS_FREEBSD) | 245 #elif defined(OS_POSIX) && !defined(OS_FREEBSD) |
| 232 if (err != EAI_NONAME && err != EAI_NODATA) | 246 if (err != EAI_NONAME && err != EAI_NODATA) |
| 233 return ERR_NAME_RESOLUTION_FAILED; | 247 return ERR_NAME_RESOLUTION_FAILED; |
| 234 #endif | 248 #endif |
| 235 | 249 |
| 236 return ERR_NAME_NOT_RESOLVED; | 250 return ERR_NAME_NOT_RESOLVED; |
| 237 } | 251 } |
| 238 | 252 |
| 239 *addrlist = AddressList::CreateByAdoptingFromSystem(ai); | 253 *addrlist = AddressList::CreateFromAddrinfo(ai); |
| 240 return OK; | 254 return OK; |
| 241 } | 255 } |
| 242 | 256 |
| 243 } // namespace net | 257 } // namespace net |
| OLD | NEW |