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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 if (onBadCertificate != null) { | 340 if (onBadCertificate != null) { |
341 _secureFilter.registerBadCertificateCallback(onBadCertificate); | 341 _secureFilter.registerBadCertificateCallback(onBadCertificate); |
342 } | 342 } |
343 var futureSocket; | 343 var futureSocket; |
344 if (socket == null) { | 344 if (socket == null) { |
345 futureSocket = RawSocket.connect(host, requestedPort); | 345 futureSocket = RawSocket.connect(host, requestedPort); |
346 } else { | 346 } else { |
347 futureSocket = new Future.value(socket); | 347 futureSocket = new Future.value(socket); |
348 } | 348 } |
349 futureSocket.then((rawSocket) { | 349 futureSocket.then((rawSocket) { |
350 rawSocket.writeEventsEnabled = false; | |
351 _socket = rawSocket; | 350 _socket = rawSocket; |
| 351 _socket.readEventsEnabled = true; |
| 352 _socket.writeEventsEnabled = false; |
352 if (_socketSubscription == null) { | 353 if (_socketSubscription == null) { |
353 // If a current subscription is provided use this otherwise | 354 // If a current subscription is provided use this otherwise |
354 // create a new one. | 355 // create a new one. |
355 _socketSubscription = _socket.listen(_eventDispatcher, | 356 _socketSubscription = _socket.listen(_eventDispatcher, |
356 onError: _errorHandler, | 357 onError: _errorHandler, |
357 onDone: _doneHandler); | 358 onDone: _doneHandler); |
358 } else { | 359 } else { |
359 _socketSubscription.onData(_eventDispatcher); | 360 _socketSubscription.onData(_eventDispatcher); |
360 _socketSubscription.onError(_errorHandler); | 361 _socketSubscription.onError(_errorHandler); |
361 _socketSubscription.onDone(_doneHandler); | 362 _socketSubscription.onDone(_doneHandler); |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 void destroy(); | 866 void destroy(); |
866 void handshake(); | 867 void handshake(); |
867 void init(); | 868 void init(); |
868 X509Certificate get peerCertificate; | 869 X509Certificate get peerCertificate; |
869 int processBuffer(int bufferIndex); | 870 int processBuffer(int bufferIndex); |
870 void registerBadCertificateCallback(Function callback); | 871 void registerBadCertificateCallback(Function callback); |
871 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler); | 872 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler); |
872 | 873 |
873 List<_ExternalBuffer> get buffers; | 874 List<_ExternalBuffer> get buffers; |
874 } | 875 } |
OLD | NEW |