| 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 = const bool.fromEnvironment('SILENT_OBSERVATORY'); | 7 final bool silentObservatory = const bool.fromEnvironment('SILENT_OBSERVATORY'); |
| 8 | 8 |
| 9 void serverPrint(String s) { | 9 void serverPrint(String s) { |
| 10 if (silentObservatory) { | 10 if (silentObservatory) { |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 return this; | 328 return this; |
| 329 } | 329 } |
| 330 | 330 |
| 331 // Startup HTTP server. | 331 // Startup HTTP server. |
| 332 var pollError; | 332 var pollError; |
| 333 var pollStack; | 333 var pollStack; |
| 334 Future<bool> poll() async { | 334 Future<bool> poll() async { |
| 335 try { | 335 try { |
| 336 var address; | 336 var address; |
| 337 if (Platform.isFuchsia) { | 337 if (Platform.isFuchsia) { |
| 338 address = InternetAddress.ANY_IP_V4; | 338 address = InternetAddress.ANY_IP_V6; |
| 339 } else { | 339 } else { |
| 340 var addresses = await InternetAddress.lookup(_ip); | 340 var addresses = await InternetAddress.lookup(_ip); |
| 341 // Prefer IPv4 addresses. | 341 // Prefer IPv4 addresses. |
| 342 for (var i = 0; i < addresses.length; i++) { | 342 for (var i = 0; i < addresses.length; i++) { |
| 343 address = addresses[i]; | 343 address = addresses[i]; |
| 344 if (address.type == InternetAddressType.IP_V4) break; | 344 if (address.type == InternetAddressType.IP_V4) break; |
| 345 } | 345 } |
| 346 } | 346 } |
| 347 _server = await HttpServer.bind(address, _port); | 347 _server = await HttpServer.bind(address, _port); |
| 348 return true; | 348 return true; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 _server = null; | 415 _server = null; |
| 416 serverPrint('Could not shutdown Observatory HTTP server:\n$e\n$st\n'); | 416 serverPrint('Could not shutdown Observatory HTTP server:\n$e\n$st\n'); |
| 417 _notifyServerState(""); | 417 _notifyServerState(""); |
| 418 onServerAddressChange(null); | 418 onServerAddressChange(null); |
| 419 return this; | 419 return this; |
| 420 }); | 420 }); |
| 421 } | 421 } |
| 422 } | 422 } |
| 423 | 423 |
| 424 void _notifyServerState(String uri) native "VMServiceIO_NotifyServerState"; | 424 void _notifyServerState(String uri) native "VMServiceIO_NotifyServerState"; |
| OLD | NEW |