Index: runtime/bin/vmservice_dartium.cc |
diff --git a/runtime/bin/vmservice_dartium.cc b/runtime/bin/vmservice_dartium.cc |
index c0e6f789c17acb02547d9e9271597350ecdf6ca2..2b674d2193abeb69406a4df420fec05fce412b0c 100644 |
--- a/runtime/bin/vmservice_dartium.cc |
+++ b/runtime/bin/vmservice_dartium.cc |
@@ -24,10 +24,17 @@ namespace bin { |
return 0; \ |
} |
- |
-static const char* DEFAULT_VM_SERVICE_SERVER_IP = "127.0.0.1"; |
+static const char* DART_IPV6_ONLY_FLAG = "DART_IPV6_ONLY"; |
+static const char* DEFAULT_VM_SERVICE_SERVER_IP_V6 = "::1"; |
+static const char* DEFAULT_VM_SERVICE_SERVER_IP_V4 = "127.0.0.1"; |
static const int DEFAULT_VM_SERVICE_SERVER_PORT = 0; |
+static bool IsIpv6Only() { |
+ char* v = getenv(DART_IPV6_ONLY_FLAG); |
+ if (!v) return 0; |
+ return v[0] == '1'; |
+} |
+ |
void VmServiceServer::Bootstrap() { |
if (!Platform::Initialize()) { |
fprintf(stderr, "Platform::Initialize() failed\n"); |
@@ -59,7 +66,9 @@ Dart_Isolate VmServiceServer::CreateIsolate(const uint8_t* snapshot_buffer) { |
ASSERT(Dart_IsServiceIsolate(isolate)); |
if (!VmService::Setup( |
- DEFAULT_VM_SERVICE_SERVER_IP, DEFAULT_VM_SERVICE_SERVER_PORT, |
+ IsIpv6Only() ? DEFAULT_VM_SERVICE_SERVER_IP_V6 : |
+ DEFAULT_VM_SERVICE_SERVER_IP_V4, |
+ DEFAULT_VM_SERVICE_SERVER_PORT, |
false /* running_precompiled */, false /* disable origin checks */, |
false /* trace_loading */)) { |
fprintf(stderr, "Vmservice::Setup failed: %s\n", |