| OLD | NEW | 
|    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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  268         socket: connection, |  268         socket: connection, | 
|  269         requestClientCertificate: requestClientCertificate, |  269         requestClientCertificate: requestClientCertificate, | 
|  270         requireClientCertificate: requireClientCertificate, |  270         requireClientCertificate: requireClientCertificate, | 
|  271         supportedProtocols: supportedProtocols) |  271         supportedProtocols: supportedProtocols) | 
|  272     .then((RawSecureSocket secureConnection) { |  272     .then((RawSecureSocket secureConnection) { | 
|  273       if (_closed) { |  273       if (_closed) { | 
|  274         secureConnection.close(); |  274         secureConnection.close(); | 
|  275       } else { |  275       } else { | 
|  276         _controller.add(secureConnection); |  276         _controller.add(secureConnection); | 
|  277       } |  277       } | 
|  278     }).catchError((e) { |  278     }).catchError((e, s) { | 
|  279       if (!_closed) { |  279       if (!_closed) { | 
|  280         _controller.addError(e); |  280         _controller.addError(e, s); | 
|  281       } |  281       } | 
|  282     }); |  282     }); | 
|  283   } |  283   } | 
|  284  |  284  | 
|  285   void _onError(e, [StackTrace stackTrace]) { |  | 
|  286     _controller.addError(e, stackTrace); |  | 
|  287   } |  | 
|  288  |  | 
|  289   void _onDone() { |  | 
|  290     _controller.close(); |  | 
|  291   } |  | 
|  292  |  | 
|  293   void _onPauseStateChange() { |  285   void _onPauseStateChange() { | 
|  294     if (_controller.isPaused) { |  286     if (_controller.isPaused) { | 
|  295       _subscription.pause(); |  287       _subscription.pause(); | 
|  296     } else { |  288     } else { | 
|  297       _subscription.resume(); |  289       _subscription.resume(); | 
|  298     } |  290     } | 
|  299   } |  291   } | 
|  300  |  292  | 
|  301   void _onSubscriptionStateChange() { |  293   void _onSubscriptionStateChange() { | 
|  302     if (_controller.hasListener) { |  294     if (_controller.hasListener) { | 
|  303       _subscription = _socket.listen(_onData, |  295       _subscription = _socket.listen(_onData, | 
|  304                                      onDone: _onDone, |  296                                      onError: _controller.addError, | 
|  305                                      onError: _onError); |  297                                      onDone: _controller.close); | 
|  306     } else { |  298     } else { | 
|  307       close(); |  299       close(); | 
|  308     } |  300     } | 
|  309   } |  301   } | 
|  310  |  302  | 
|  311   void set _owner(owner) { (_socket as dynamic)._owner = owner; } |  303   void set _owner(owner) { | 
 |  304     (_socket as dynamic)._owner = owner; | 
 |  305   } | 
|  312 } |  306 } | 
|  313  |  307  | 
|  314  |  308  | 
| OLD | NEW |