Motivation:
When we read a CLOSE_NOTIFY message, we immediately begin closing the
connection down. This *can* cause an instant close, and if that occurs
then we will have un-flushed data in the read buffer that we never
deliver.
If we receive a CLOSE_NOTIFY we will not receive more application data,
so we should deliver all that application data before we initiate the
shutdown process.
Modifications:
Unbuffer the buffered reads when we read a CLOSE_NOTIFY.
Result:
All reads will be shipped before channelInactive can fire.
Motivation:
As OpenSSL 1.1.1 has just been released, it is reasonable for users to
be able to use it with SwiftNIO.
Modifications:
- Fixed an issue where we would fail to exclude TLSv1.3 when users set
max TLS version to lower than TLSv1.3.
- Fixed an issue where we'd fail to read application data sent in the
same TCP segment as a Finished message.
- Fixed a minor typo in error message strings.
Result:
OpenSSL 1.1.1 is formally supported.
Motivation:
Currently we use OpenSSL with MemoryBIO objects. These objects are an
implementation of OpenSSL's pervasive BIO abstraction that wrap a simple
heap-allocated buffer.
The result of this is that we have the following data pipeline for
reads:
1. Ciphertext read from the socket into ByteBuffer
2. Ciphertext copied from ByteBuffer to memory BIO
3. Ciphertext copied from memory BIO to transient OpenSSL memory
4. Ciphertext decrypted
5. Plaintext copied from transient OpenSSL memory to ByteBuffer.
And for writes:
1. Plaintext copied from ByteBuffer to transient OpenSSL memory.
2. Plaintext encrypted.
3. Ciphertext copied from transient OpenSSL memory to memory BIO.
4. Plaintext copied from memory BIO to ByteBuffer.
5. Plaintext copied from ByteBuffer to kernel.
The thing is, we don't need all of these copies. Specifically, the
interposing of a memory BIO is totally unnnecessary. We can remove
that copy by implementing the BIO abstraction ourself on top of the
ByteBuffer objects we're using.
This patch does just that.
Modifications:
- Implement a new ByteBufferBIO object.
- Rewrite some core code to use ByteBufferBIO.
Result:
Less memory copying, better efficiency.
Motivation:
There are no more flush promises in NIO, so we don't need to bend
over backwards to track them appropriately.
Modifications:
Remove the code that handles flush promises. Simplify.
Result:
Simpler, easier to follow code for buffered writes.