| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 * A high-level class for communicating securely over a TCP socket, using | 8 * A high-level class for communicating securely over a TCP socket, using |
| 9 * TLS and SSL. The [SecureSocket] exposes both a [Stream] and an | 9 * TLS and SSL. The [SecureSocket] exposes both a [Stream] and an |
| 10 * [IOSink] interface, making it ideal for using together with | 10 * [IOSink] interface, making it ideal for using together with |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 }) | 283 }) |
| 284 .catchError((error) { | 284 .catchError((error) { |
| 285 _handshakeComplete.completeError(error); | 285 _handshakeComplete.completeError(error); |
| 286 _close(); | 286 _close(); |
| 287 }); | 287 }); |
| 288 } | 288 } |
| 289 | 289 |
| 290 StreamSubscription listen(void onData(RawSocketEvent data), | 290 StreamSubscription listen(void onData(RawSocketEvent data), |
| 291 {void onError(AsyncError error), | 291 {void onError(AsyncError error), |
| 292 void onDone(), | 292 void onDone(), |
| 293 bool unsubscribeOnError}) { | 293 bool cancelOnError}) { |
| 294 if (_writeEventsEnabled) { | 294 if (_writeEventsEnabled) { |
| 295 _writeEventsEnabled = false; | 295 _writeEventsEnabled = false; |
| 296 _controller.add(RawSocketEvent.WRITE); | 296 _controller.add(RawSocketEvent.WRITE); |
| 297 } | 297 } |
| 298 return _stream.listen(onData, | 298 return _stream.listen(onData, |
| 299 onError: onError, | 299 onError: onError, |
| 300 onDone: onDone, | 300 onDone: onDone, |
| 301 unsubscribeOnError: unsubscribeOnError); | 301 cancelOnError: cancelOnError); |
| 302 } | 302 } |
| 303 | 303 |
| 304 void _verifyFields() { | 304 void _verifyFields() { |
| 305 assert(is_server is bool); | 305 assert(is_server is bool); |
| 306 assert(_socket == null || _socket is RawSocket); | 306 assert(_socket == null || _socket is RawSocket); |
| 307 if (host is! String) { | 307 if (host is! String) { |
| 308 throw new ArgumentError( | 308 throw new ArgumentError( |
| 309 "RawSecureSocket constructor: host is not a String"); | 309 "RawSecureSocket constructor: host is not a String"); |
| 310 } | 310 } |
| 311 if (certificateName != null && certificateName is! String) { | 311 if (certificateName != null && certificateName is! String) { |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 void destroy(); | 757 void destroy(); |
| 758 void handshake(); | 758 void handshake(); |
| 759 void init(); | 759 void init(); |
| 760 X509Certificate get peerCertificate; | 760 X509Certificate get peerCertificate; |
| 761 int processBuffer(int bufferIndex); | 761 int processBuffer(int bufferIndex); |
| 762 void registerBadCertificateCallback(Function callback); | 762 void registerBadCertificateCallback(Function callback); |
| 763 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler); | 763 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler); |
| 764 | 764 |
| 765 List<_ExternalBuffer> get buffers; | 765 List<_ExternalBuffer> get buffers; |
| 766 } | 766 } |
| OLD | NEW |