diff --git a/Source/MQTTnet/Adapter/MqttPacketInspector.cs b/Source/MQTTnet/Adapter/MqttPacketInspector.cs index e7983717d..f646d49f6 100644 --- a/Source/MQTTnet/Adapter/MqttPacketInspector.cs +++ b/Source/MQTTnet/Adapter/MqttPacketInspector.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Buffers; using System.IO; using System.Threading.Tasks; using MQTTnet.Diagnostics.Logger; @@ -81,6 +82,22 @@ public void FillReceiveBuffer(ReadOnlySpan buffer) _receivedPacketBuffer?.Write(buffer); } + public void FillReceiveBuffer(ReadOnlySequence buffer) + { + if (!_asyncEvent.HasHandlers) + { + return; + } + + if (_receivedPacketBuffer != null) + { + foreach (var memory in buffer) + { + _receivedPacketBuffer.Write(memory.Span); + } + } + } + async Task InspectPacket(byte[] buffer, MqttPacketFlowDirection direction) { try