Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: pkg/analysis_server/lib/src/channel/byte_stream_channel.dart

Issue 694413004: Flush analysis server output stream when closed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library channel.byte_stream; 5 library channel.byte_stream;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 /** 74 /**
75 * Future that will be completed when the input stream is closed. 75 * Future that will be completed when the input stream is closed.
76 */ 76 */
77 Future get closed { 77 Future get closed {
78 return _closed.future; 78 return _closed.future;
79 } 79 }
80 80
81 @override 81 @override
82 void close() { 82 void close() {
83 if (!_closed.isCompleted) { 83 output.flush().then((_) {
84 _closed.complete(); 84 if (!_closed.isCompleted) {
85 } 85 _closed.complete();
86 }
87 });
86 } 88 }
87 89
88 @override 90 @override
89 void listen(void onRequest(Request request), {Function onError, void 91 void listen(void onRequest(Request request), {Function onError, void
90 onDone()}) { 92 onDone()}) {
91 input.transform((new Utf8Codec()).decoder).transform(new LineSplitter() 93 input.transform((new Utf8Codec()).decoder).transform(new LineSplitter()
92 ).listen((String data) => _readRequest(data, onRequest), onError: onErro r, 94 ).listen((String data) => _readRequest(data, onRequest), onError: onErro r,
93 onDone: () { 95 onDone: () {
94 close(); 96 close();
95 onDone(); 97 onDone();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 ServerCommunicationChannel.FromJson.start(); 138 ServerCommunicationChannel.FromJson.start();
137 Request request = new Request.fromString(data); 139 Request request = new Request.fromString(data);
138 ServerCommunicationChannel.FromJson.stop(); 140 ServerCommunicationChannel.FromJson.stop();
139 if (request == null) { 141 if (request == null) {
140 sendResponse(new Response.invalidRequestFormat()); 142 sendResponse(new Response.invalidRequestFormat());
141 return; 143 return;
142 } 144 }
143 onRequest(request); 145 onRequest(request);
144 } 146 }
145 } 147 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698