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

Unified Diff: webrtc/base/nethelpers.cc

Issue 1982733002: Re-enabling socket tests that were previously flaky. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing ifdefs. Using same logic as network.cc. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/messagequeue.cc ('k') | webrtc/base/physicalsocketserver_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/nethelpers.cc
diff --git a/webrtc/base/nethelpers.cc b/webrtc/base/nethelpers.cc
index d9015283b0baef98f2a370acdf334f9603a8765d..fddfdaf58b5832318fe4f73d4f2ad7262f5b03bf 100644
--- a/webrtc/base/nethelpers.cc
+++ b/webrtc/base/nethelpers.cc
@@ -17,6 +17,13 @@
#include <ws2tcpip.h>
#include "webrtc/base/win32.h"
#endif
+#if defined(WEBRTC_POSIX) && !defined(__native_client__)
+#if defined(WEBRTC_ANDROID)
+#include "webrtc/base/ifaddrs-android.h"
+#else
+#include <ifaddrs.h>
+#endif
+#endif // defined(WEBRTC_POSIX) && !defined(__native_client__)
#include "webrtc/base/byteorder.h"
#include "webrtc/base/logging.h"
@@ -118,10 +125,7 @@ int inet_pton(int af, const char* src, void *dst) {
}
bool HasIPv6Enabled() {
-#if !defined(WEBRTC_WIN)
- // We only need to check this for Windows XP (so far).
- return true;
-#else
+#if defined(WEBRTC_WIN)
if (IsWindowsVistaOrLater()) {
return true;
}
@@ -157,6 +161,22 @@ bool HasIPv6Enabled() {
}
}
return false;
+#elif defined(WEBRTC_POSIX) && !defined(__native_client__)
+ bool has_ipv6 = false;
+ struct ifaddrs* ifa;
+ if (getifaddrs(&ifa) < 0) {
+ return false;
+ }
+ for (struct ifaddrs* cur = ifa; cur != nullptr; cur = cur->ifa_next) {
+ if (cur->ifa_addr->sa_family == AF_INET6) {
+ has_ipv6 = true;
+ break;
+ }
+ }
+ freeifaddrs(ifa);
+ return has_ipv6;
+#else
+ return true;
#endif
}
} // namespace rtc
« no previous file with comments | « webrtc/base/messagequeue.cc ('k') | webrtc/base/physicalsocketserver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698