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

Side by Side Diff: sdk/lib/io/secure_server_socket.dart

Issue 16021016: dart:io | Fix issue involving SecureServerSocket error handling and HttpServer stream cancellation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add tests for cancelOnError on SecureServerSocket. Created 7 years, 6 months 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 | « sdk/lib/io/http_impl.dart ('k') | tests/standalone/io/raw_secure_server_socket_test.dart » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of dart.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * The [SecureServerSocket] is a server socket, providing a stream of high-level 8 * The [SecureServerSocket] is a server socket, providing a stream of high-level
9 * [Socket]s. 9 * [Socket]s.
10 * 10 *
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 socket: connection, 220 socket: connection,
221 requestClientCertificate: requestClientCertificate, 221 requestClientCertificate: requestClientCertificate,
222 requireClientCertificate: requireClientCertificate) 222 requireClientCertificate: requireClientCertificate)
223 .then((RawSecureSocket secureConnection) { 223 .then((RawSecureSocket secureConnection) {
224 if (_closed) { 224 if (_closed) {
225 secureConnection.close(); 225 secureConnection.close();
226 } else { 226 } else {
227 _controller.add(secureConnection); 227 _controller.add(secureConnection);
228 } 228 }
229 }).catchError((e) { 229 }).catchError((e) {
230 if (_closed) { 230 if (!_closed) {
231 throw e;
232 } else {
233 _controller.addError(e); 231 _controller.addError(e);
234 close();
235 } 232 }
236 }); 233 });
237 } 234 }
238 235
239 void _onError(e) { 236 void _onError(e) {
240 _controller.addError(e); 237 _controller.addError(e);
241 close();
242 } 238 }
243 239
244 void _onDone() { 240 void _onDone() {
245 _controller.close(); 241 _controller.close();
246 } 242 }
247 243
248 void _onPauseStateChange() { 244 void _onPauseStateChange() {
249 if (_controller.isPaused) { 245 if (_controller.isPaused) {
250 _subscription.pause(); 246 _subscription.pause();
251 } else { 247 } else {
252 _subscription.resume(); 248 _subscription.resume();
253 } 249 }
254 } 250 }
255 251
256 void _onSubscriptionStateChange() { 252 void _onSubscriptionStateChange() {
257 if (_controller.hasListener) { 253 if (_controller.hasListener) {
258 _subscription = _socket.listen(_onData, 254 _subscription = _socket.listen(_onData,
259 onDone: _onDone, 255 onDone: _onDone,
260 onError: _onError); 256 onError: _onError);
261 } else { 257 } else {
262 close(); 258 close();
263 } 259 }
264 } 260 }
265 } 261 }
266 262
267 263
OLDNEW
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | tests/standalone/io/raw_secure_server_socket_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698