General code refactoring.

This commit is contained in:
Christian Kratky
2020-05-21 12:40:51 +02:00
parent 3f5d4e9825
commit dbe12b9c48
27 changed files with 192 additions and 119 deletions
@@ -8,16 +8,10 @@ namespace MQTTnet.AspNetCore
{
public class SpanBasedMqttPacketWriter : IMqttPacketWriter
{
private readonly ArrayPool<byte> _pool;
readonly ArrayPool<byte> _pool = ArrayPool<byte>.Create();
public SpanBasedMqttPacketWriter()
{
_pool = ArrayPool<byte>.Create();
}
private byte[] _buffer;
private int _position;
byte[] _buffer;
int _position;
public int Length { get; set; }
@@ -112,7 +106,7 @@ namespace MQTTnet.AspNetCore
Commit(payload.Length);
}
private void Commit(int count)
void Commit(int count)
{
if (_position == Length)
{
@@ -122,7 +116,7 @@ namespace MQTTnet.AspNetCore
_position += count;
}
private void GrowIfNeeded(int requiredAdditional)
void GrowIfNeeded(int requiredAdditional)
{
var requiredTotal = _position + requiredAdditional;
if (_buffer.Length >= requiredTotal)