Chromium Code Reviews| Index: runtime/bin/vmservice_dartium.cc |
| diff --git a/runtime/bin/vmservice_dartium.cc b/runtime/bin/vmservice_dartium.cc |
| index c0e6f789c17acb02547d9e9271597350ecdf6ca2..287f8c2eec72a48fd02b626708873181560299a5 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 = "localhost"; |
|
rmacnak
2017/06/20 21:24:06
Do you mean ::1?
localhost could resolve to 127.0
terry
2017/06/20 21:39:01
Done.
|
| +static const char* DEFAULT_VM_SERVICE_SERVER_IP_V4 = "127.0.0.1"; |
| static const int DEFAULT_VM_SERVICE_SERVER_PORT = 0; |
| +static int IsIpv6Only() { |
|
rmacnak
2017/06/20 21:24:06
int -> bool
terry
2017/06/20 21:39:02
Done.
|
| + 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"); |
| @@ -58,8 +65,11 @@ Dart_Isolate VmServiceServer::CreateIsolate(const uint8_t* snapshot_buffer) { |
| Builtin::SetNativeResolver(Builtin::kIOLibrary); |
| ASSERT(Dart_IsServiceIsolate(isolate)); |
| + int ipv6 = IsIpv6Only(); |
|
rmacnak
2017/06/20 21:24:05
int -> bool
terry
2017/06/20 21:39:02
Done.
|
| if (!VmService::Setup( |
| - DEFAULT_VM_SERVICE_SERVER_IP, DEFAULT_VM_SERVICE_SERVER_PORT, |
| + ipv6 ? 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", |