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

Side by Side Diff: webrtc/base/nethelpers.cc

Issue 2083803002: Fix IPv6 support issue. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: . Created 4 years, 6 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
« no previous file with comments | « no previous file | webrtc/p2p/base/turnport.h » ('j') | webrtc/p2p/base/turnport.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2008 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2008 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 26 matching lines...) Expand all
37 ASSERT(false); 37 ASSERT(false);
38 LOG(LS_WARNING) << "ResolveHostname() is not implemented for NaCl"; 38 LOG(LS_WARNING) << "ResolveHostname() is not implemented for NaCl";
39 return -1; 39 return -1;
40 #else // __native_client__ 40 #else // __native_client__
41 if (!addresses) { 41 if (!addresses) {
42 return -1; 42 return -1;
43 } 43 }
44 addresses->clear(); 44 addresses->clear();
45 struct addrinfo* result = NULL; 45 struct addrinfo* result = NULL;
46 struct addrinfo hints = {0}; 46 struct addrinfo hints = {0};
47 // TODO(djw): For now this is IPv4 only so existing users remain unaffected. 47 // This should return both IPv4 and IPv6 addresses if available.
48 hints.ai_family = AF_INET; 48 hints.ai_family = AF_UNSPEC;
pthatcher1 2016/06/21 05:26:54 Can you make a separate CL for this in case we hav
andresp 2016/06/21 11:36:10 I am also not sure if this AF_UNSPEC is that corre
honghaiz3 2016/06/21 18:36:06 Will do it in a separate CL.
pthatcher1 2016/06/21 18:50:17 Would it make sense to use the family already pass
honghaiz3 2016/06/21 20:06:49 I think it is safer to pass in the family. But the
pthatcher1 2016/06/21 20:55:08 Yeah, the caller would need to call address.SetFam
49 hints.ai_flags = AI_ADDRCONFIG; 49 hints.ai_flags = AI_ADDRCONFIG;
50 int ret = getaddrinfo(hostname.c_str(), NULL, &hints, &result); 50 int ret = getaddrinfo(hostname.c_str(), NULL, &hints, &result);
51 if (ret != 0) { 51 if (ret != 0) {
52 return ret; 52 return ret;
53 } 53 }
54 struct addrinfo* cursor = result; 54 struct addrinfo* cursor = result;
55 for (; cursor; cursor = cursor->ai_next) { 55 for (; cursor; cursor = cursor->ai_next) {
56 if (family == AF_UNSPEC || cursor->ai_family == family) { 56 if (family == AF_UNSPEC || cursor->ai_family == family) {
57 IPAddress ip; 57 IPAddress ip;
58 if (IPFromAddrInfo(cursor, &ip)) { 58 if (IPFromAddrInfo(cursor, &ip)) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 break; 173 break;
174 } 174 }
175 } 175 }
176 freeifaddrs(ifa); 176 freeifaddrs(ifa);
177 return has_ipv6; 177 return has_ipv6;
178 #else 178 #else
179 return true; 179 return true;
180 #endif 180 #endif
181 } 181 }
182 } // namespace rtc 182 } // namespace rtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/p2p/base/turnport.h » ('j') | webrtc/p2p/base/turnport.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698