| 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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 if (_socketClosedWrite) return; | 664 if (_socketClosedWrite) return; |
| 665 var encrypted = _secureFilter.buffers[WRITE_ENCRYPTED]; | 665 var encrypted = _secureFilter.buffers[WRITE_ENCRYPTED]; |
| 666 var plaintext = _secureFilter.buffers[WRITE_PLAINTEXT]; | 666 var plaintext = _secureFilter.buffers[WRITE_PLAINTEXT]; |
| 667 while (true) { | 667 while (true) { |
| 668 if (encrypted.length > 0) { | 668 if (encrypted.length > 0) { |
| 669 // Write from the filter to the socket. | 669 // Write from the filter to the socket. |
| 670 int bytes = _socket.write(encrypted.data, | 670 int bytes = _socket.write(encrypted.data, |
| 671 encrypted.start, | 671 encrypted.start, |
| 672 encrypted.length); | 672 encrypted.length); |
| 673 encrypted.advanceStart(bytes); | 673 encrypted.advanceStart(bytes); |
| 674 if (encrypted.start < encrypted.length) { | 674 if (encrypted.length > 0) { |
| 675 // The socket has blocked while we have data to write. | 675 // The socket has blocked while we have data to write. |
| 676 // We must be notified when it becomes unblocked. | 676 // We must be notified when it becomes unblocked. |
| 677 _socket.writeEventsEnabled = true; | 677 _socket.writeEventsEnabled = true; |
| 678 _filterWriteEmpty = false; | 678 _filterWriteEmpty = false; |
| 679 break; | 679 break; |
| 680 } | 680 } |
| 681 } else { | 681 } else { |
| 682 var plaintext = _secureFilter.buffers[WRITE_PLAINTEXT]; | 682 var plaintext = _secureFilter.buffers[WRITE_PLAINTEXT]; |
| 683 if (plaintext.length > 0) { | 683 if (plaintext.length > 0) { |
| 684 int plaintext_bytes = _secureFilter.processBuffer(WRITE_PLAINTEXT); | 684 int plaintext_bytes = _secureFilter.processBuffer(WRITE_PLAINTEXT); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 void destroy(); | 738 void destroy(); |
| 739 void handshake(); | 739 void handshake(); |
| 740 void init(); | 740 void init(); |
| 741 X509Certificate get peerCertificate; | 741 X509Certificate get peerCertificate; |
| 742 int processBuffer(int bufferIndex); | 742 int processBuffer(int bufferIndex); |
| 743 void registerBadCertificateCallback(Function callback); | 743 void registerBadCertificateCallback(Function callback); |
| 744 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler); | 744 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler); |
| 745 | 745 |
| 746 List<_ExternalBuffer> get buffers; | 746 List<_ExternalBuffer> get buffers; |
| 747 } | 747 } |
| OLD | NEW |