Fall back to IPv4 in devfs_test.dart (#10196)

Fixes the broken build in the Chromium bots
This commit is contained in:
Todd Volkert
2017-05-18 22:41:41 -07:00
committed by GitHub
parent e8ac331d87
commit a253605c76

View File

@@ -359,8 +359,14 @@ class MockVMService extends BasicMock implements VMService {
VM get vm => _vm;
Future<Null> setUp() async {
_server = await HttpServer.bind(InternetAddress.LOOPBACK_IP_V6, 0);
_httpAddress = Uri.parse('http://[::1]:${_server.port}');
try {
_server = await HttpServer.bind(InternetAddress.LOOPBACK_IP_V6, 0);
_httpAddress = Uri.parse('http://[::1]:${_server.port}');
} on SocketException {
// Fall back to IPv4 if the host doesn't support binding to IPv6 localhost
_server = await HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 0);
_httpAddress = Uri.parse('http://127.0.0.1:${_server.port}');
}
_server.listen((HttpRequest request) {
final String fsName = request.headers.value('dev_fs_name');
final String devicePath = UTF8.decode(BASE64.decode(request.headers.value('dev_fs_uri_b64')));