Chromium Code Reviews| Index: runtime/bin/vmservice/vmservice_io.dart |
| diff --git a/runtime/bin/vmservice/vmservice_io.dart b/runtime/bin/vmservice/vmservice_io.dart |
| index 2d99e17eb85787fab4fe322e4732688083870545..15a9633a4513ea7f47c3807a347ab0c5eef0ffbd 100644 |
| --- a/runtime/bin/vmservice/vmservice_io.dart |
| +++ b/runtime/bin/vmservice/vmservice_io.dart |
| @@ -28,20 +28,27 @@ var _signalWatch; |
| Server server; |
| Future<Server> serverFuture; |
| -void _bootServer() { |
| +_onShutdown() { |
| + if (server != null) { |
| + server.close(true).catchError((e, st) => null); |
|
zra
2015/03/24 21:53:59
Maybe the catchError should assert() so that we at
Cutch
2015/03/24 23:39:07
Done.
|
| + } |
| +} |
| + |
| +_bootServer() { |
|
zra
2015/03/24 21:53:59
Why drop the return types?
Cutch
2015/03/24 23:39:07
I'm omitting 'void' return types in Dart code.
|
| // Load resources. |
| _triggerResourceLoad(); |
| // Lazily create service. |
| var service = new VMService(); |
| + service.onShutdown = _onShutdown; |
| // Lazily create server. |
| server = new Server(service, _ip, _port); |
| } |
| -void _clearFuture(_) { |
| +_clearFuture(_) { |
| serverFuture = null; |
| } |
| -void _onSignal(ProcessSignal signal) { |
| +_onSignal(ProcessSignal signal) { |
| if (serverFuture != null) { |
| // Still waiting. |
| return; |
| @@ -57,7 +64,7 @@ void _onSignal(ProcessSignal signal) { |
| } |
| } |
| -void _registerSignalHandler() { |
| +_registerSignalHandler() { |
| if (_isWindows) { |
| // Cannot register for signals on Windows. |
| return; |