| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of vmservice_io; | 5 part of vmservice_io; |
| 6 | 6 |
| 7 final bool silentObservatory = | 7 final bool silentObservatory = |
| 8 const bool.fromEnvironment('SILENT_OBSERVATORY'); | 8 const bool.fromEnvironment('SILENT_OBSERVATORY'); |
| 9 | 9 |
| 10 void serverPrint(String s) { | 10 void serverPrint(String s) { |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 Future startup() async { | 325 Future startup() async { |
| 326 if (_server != null) { | 326 if (_server != null) { |
| 327 // Already running. | 327 // Already running. |
| 328 return this; | 328 return this; |
| 329 } | 329 } |
| 330 | 330 |
| 331 // Startup HTTP server. | 331 // Startup HTTP server. |
| 332 try { | 332 try { |
| 333 var address; | 333 var address; |
| 334 if (Platform.isFuchsia) { | 334 if (Platform.isFuchsia) { |
| 335 address = InternetAddress.ANY_IP_V6; | 335 address = InternetAddress.ANY_IP_V4; |
| 336 } else { | 336 } else { |
| 337 var addresses = await InternetAddress.lookup(_ip); | 337 var addresses = await InternetAddress.lookup(_ip); |
| 338 // Prefer IPv4 addresses. | 338 // Prefer IPv4 addresses. |
| 339 for (var i = 0; i < addresses.length; i++) { | 339 for (var i = 0; i < addresses.length; i++) { |
| 340 address = addresses[i]; | 340 address = addresses[i]; |
| 341 if (address.type == InternetAddressType.IP_V4) break; | 341 if (address.type == InternetAddressType.IP_V4) break; |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 _server = await HttpServer.bind(address, _port); | 344 _server = await HttpServer.bind(address, _port); |
| 345 _server.listen(_requestHandler, cancelOnError: true); | 345 _server.listen(_requestHandler, cancelOnError: true); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 _notifyServerState(""); | 383 _notifyServerState(""); |
| 384 onServerAddressChange(null); | 384 onServerAddressChange(null); |
| 385 return this; | 385 return this; |
| 386 }); | 386 }); |
| 387 } | 387 } |
| 388 | 388 |
| 389 } | 389 } |
| 390 | 390 |
| 391 void _notifyServerState(String uri) | 391 void _notifyServerState(String uri) |
| 392 native "VMServiceIO_NotifyServerState"; | 392 native "VMServiceIO_NotifyServerState"; |
| OLD | NEW |