Chromium Code Reviews| Index: runtime/bin/vmservice/server.dart |
| diff --git a/runtime/bin/vmservice/server.dart b/runtime/bin/vmservice/server.dart |
| index 826205326a4d1390e4f4987fff3738c4683c5dcc..a17c2cfaf2f7b5271525f893ed226bd18a0799b2 100644 |
| --- a/runtime/bin/vmservice/server.dart |
| +++ b/runtime/bin/vmservice/server.dart |
| @@ -135,9 +135,10 @@ class Server { |
| var ip = _server.address.address; |
| var port = _server.port; |
| if (useAuthToken) { |
| - return Uri.parse('http://$ip:$port/$serviceAuthToken/'); |
| + return new Uri(scheme: 'http', host: ip, port: port, |
| + path: serviceAuthToken); |
| } else { |
| - return Uri.parse('http://$ip:$port/'); |
| + return new Uri(scheme: 'http', host: ip, port: port); |
| } |
| } |
| @@ -154,6 +155,7 @@ class Server { |
| // Explicitly add localhost and 127.0.0.1 on any port (necessary for |
| // adb port forwarding). |
| if ((uri.host == 'localhost') || |
| + (uri.host == '::1') || |
| (uri.host == '127.0.0.1')) { |
| return true; |
| } |
| @@ -300,28 +302,28 @@ class Server { |
| } |
| } |
| - Future startup() { |
| + Future startup() async { |
| if (_server != null) { |
| // Already running. |
| - return new Future.value(this); |
| + return this; |
| } |
| - var address = new InternetAddress(_ip); |
| // Startup HTTP server. |
| - return HttpServer.bind(address, _port).then((s) { |
| - _server = s; |
| + try { |
| + var address = (await InternetAddress.lookup(_ip))[0]; |
|
rmacnak
2016/11/18 23:50:33
On my workstation, the IPv6 result comes back firs
Cutch
2016/11/19 22:21:37
This code should stay consistent with the existing
rmacnak
2016/11/22 04:00:52
Done.
|
| + _server = await HttpServer.bind(address, _port); |
| _server.listen(_requestHandler, cancelOnError: true); |
| print('Observatory listening on $serverAddress'); |
| // Server is up and running. |
| _notifyServerState(serverAddress.toString()); |
| onServerAddressChange('$serverAddress'); |
| return this; |
| - }).catchError((e, st) { |
| + } catch (e, st) { |
| print('Could not start Observatory HTTP server:\n$e\n$st\n'); |
| _notifyServerState(""); |
| onServerAddressChange(null); |
| return this; |
| - }); |
| + } |
| } |
| Future cleanup(bool force) { |