| Index: pkg/analysis_server/lib/src/channel/byte_stream_channel.dart
|
| diff --git a/pkg/analysis_server/lib/src/channel/byte_stream_channel.dart b/pkg/analysis_server/lib/src/channel/byte_stream_channel.dart
|
| index 14d7268163b0a8f6d85cb4067fd2555d4fa2c3b8..bfcac2dd69f4b934db6767e23446ad6839cf1180 100644
|
| --- a/pkg/analysis_server/lib/src/channel/byte_stream_channel.dart
|
| +++ b/pkg/analysis_server/lib/src/channel/byte_stream_channel.dart
|
| @@ -29,18 +29,20 @@ class ByteStreamClientChannel implements ClientCommunicationChannel {
|
| Stream<Notification> notificationStream;
|
|
|
| ByteStreamClientChannel(this.input, this.output) {
|
| - Stream jsonStream = input.transform(
|
| - (new Utf8Codec()).decoder).transform(
|
| - new LineSplitter()).transform(
|
| - new JsonStreamDecoder()).where((json) => json is Map).asBroadcastStream();
|
| - responseStream = jsonStream.where(
|
| - (json) =>
|
| - json[Notification.EVENT] ==
|
| - null).transform(new ResponseConverter()).asBroadcastStream();
|
| - notificationStream = jsonStream.where(
|
| - (json) =>
|
| - json[Notification.EVENT] !=
|
| - null).transform(new NotificationConverter()).asBroadcastStream();
|
| + Stream jsonStream = input
|
| + .transform((new Utf8Codec()).decoder)
|
| + .transform(new LineSplitter())
|
| + .transform(new JsonStreamDecoder())
|
| + .where((json) => json is Map)
|
| + .asBroadcastStream();
|
| + responseStream = jsonStream
|
| + .where((json) => json[Notification.EVENT] == null)
|
| + .transform(new ResponseConverter())
|
| + .asBroadcastStream();
|
| + notificationStream = jsonStream
|
| + .where((json) => json[Notification.EVENT] != null)
|
| + .transform(new NotificationConverter())
|
| + .asBroadcastStream();
|
| }
|
|
|
| @override
|
| @@ -81,8 +83,8 @@ class ByteStreamServerChannel implements ServerCommunicationChannel {
|
| */
|
| bool _closeRequested = false;
|
|
|
| - ByteStreamServerChannel(this._input, this._output,
|
| - this._instrumentationService);
|
| + ByteStreamServerChannel(
|
| + this._input, this._output, this._instrumentationService);
|
|
|
| /**
|
| * Future that will be completed when the input stream is closed.
|
| @@ -101,14 +103,13 @@ class ByteStreamServerChannel implements ServerCommunicationChannel {
|
| }
|
|
|
| @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: () {
|
| + 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: () {
|
| close();
|
| onDone();
|
| });
|
|
|