Motivation:
TlsHandler
Fix TlsHandler, optimize encryption / decryption wrt Write vs Flush semantics, optimize memory retention for sparse communication, adopt IByteBuffer.GetIoBuffers() in TlsHandler.
Modifications:
- TlsHandler is rewritten to use batch->copy->write approach instead of writing directly to SslStream in order to reduce overhead of framing / writing out everything separately.
- TlsHandler uses IByteBuffer.GetIoBuffers intead of direct array access increasing compatibility for non-array-backed buffers.
- TlsHandler and TlsHandler.MediationStream use Task semantics now when reading through SslStream.
- Extra: upgraded to NBench 2.2, xUnit 2.1.0.
- Extra: better portability for .NET Core support.
Result:
TlsHandler provides better framing and much better (x2+) performance (depends on application control of flushing).
TlsHandler operates properly in edge cases when more than one frame is accepted at once and if decrypted frame size is more than 4 KB.
TlsHandler holds only 256 byte buffer while waiting for more data to arrive off the wire.
Extra: DotNetty is almost .NET Core compatible.
Motivation:
Existing rudimentary buffer pool implementation is not flexible to efficiently support scenarios with high variety in message sizes.
Modifications:
- implemented PooledByteBufferAllocator (port of PooledByteBufAllocator) and related artifacts
- made IByteBuffer implement IEquatable<IByteBuffer>, IComparable<IByteBuffer>, implemented Equals, GetHashCode.
- ported test suite for Byte Buffers and fixed discovered issues.
- added suppression of ExecutionContext flow on async read / write on socket-based channels.
- removed old pooled Byte Buffer allocator implementation.
Result:
Support for buffer pooling for larger byte sequences, more efficient usage of memory dedicated for the pool.
Motivation:
Leak of IReferenceCounted resources is a very common issue while
developing with DotNetty (both codecs and higher level applications).
Having leak detection helps identifying and resolving this kind of issues.
Modifications:
- Added ResourceLeakDetector
- Added leak-aware Byte Buffer implementations
extras
- port of missing Byte Buffer methods
- fixing minor issues with previous PRs
Result:
Simple leak detection is enabled by default on PooledByteBufferAllocator,
leaks are reported through internal logger, advanced leak detection is
available via LeakResourceDetector
enable netty's internal logging experience to ease porting efforts and streamline logging configuration
Modifications:
- ported over InternalLogger and InternalLoggerFactory
- implemented InternalLogger using EventSource
- switched existing internal logging to this (increasing parity with netty)
- added logging configuration in Echo example
- added log to xunit output to end-to-end tests
*** extras
- fixed Echo client to send back received message (not 0 bytes)
- MqttDecoder no longer closes the Channel by itself instead changing internal state to invalid and forwarding an exception.
- further fix to ReSharper's code cleanup settings to properly arrange scope modifiers
Result:
internal components can use familiar experience to perform logging, e.g. `static readonly IInternalLogger Logger = InternalLoggerFactory.GetInstance<AbstractChannel>();`
Motivation:
help contributors to write/format code in a consistent style adopted by the project
Modifications:
Added settings for implicit private visibility on type members and internal visibility on types.
Result:
contributors can apply code formatting which will remove redundant visibility keywords according to code style.