Chromium Code Reviews| Index: pkg/analysis_server/lib/src/channel.dart |
| diff --git a/pkg/analysis_server/lib/src/channel.dart b/pkg/analysis_server/lib/src/channel.dart |
| index 850585b257d710dd0b9aa80228ecd53b3152265d..f6b32300f8f93d0adbb10b4f0a98afa233e956da 100644 |
| --- a/pkg/analysis_server/lib/src/channel.dart |
| +++ b/pkg/analysis_server/lib/src/channel.dart |
| @@ -178,14 +178,29 @@ class ByteStreamServerChannel implements ServerCommunicationChannel { |
| final Stream input; |
| final IOSink output; |
| + /** |
| + * Completer that will be signalled when the input stream is closed. |
| + */ |
| + final Completer _closed = new Completer(); |
| + |
| ByteStreamServerChannel(this.input, this.output); |
| + /** |
| + * Future that will be completed when the input stream is closed. |
| + */ |
| + Future get closed { |
| + return _closed.future; |
| + } |
| + |
| @override |
| void listen(void onRequest(Request request), {Function onError, void |
| onDone()}) { |
| input.transform((new Utf8Codec()).decoder).transform(new LineSplitter() |
| ).listen((String data) => _readRequest(data, onRequest), onError: onError, |
| - onDone: onDone); |
| + onDone: () { |
| + _closed.complete(); |
|
Brian Wilkerson
2014/04/16 17:23:43
Out of curiosity, why not just add this line to on
Paul Berry
2014/04/16 17:28:40
Because onDone() isn't a local function. It's pas
|
| + onDone(); |
| + }); |
| } |
| @override |