diff --git a/Source/MQTTnet/Adapter/MqttChannelAdapter.cs b/Source/MQTTnet/Adapter/MqttChannelAdapter.cs index f55abc40a..ef2cde1bf 100644 --- a/Source/MQTTnet/Adapter/MqttChannelAdapter.cs +++ b/Source/MQTTnet/Adapter/MqttChannelAdapter.cs @@ -420,7 +420,7 @@ async Task ReceiveAsync(CancellationToken cancellationToken) var bodyArray = mqttPacket.Body.Array; do { - var bytesLeft = bodyArray.Length - bodyOffset; + var bytesLeft = bodyLength - bodyOffset; if (chunkSize > bytesLeft) { chunkSize = bytesLeft; diff --git a/Source/MQTTnet/Buffers/MqttPayloadOwner.cs b/Source/MQTTnet/Buffers/MqttPayloadOwner.cs index efd59674b..9c15c9950 100644 --- a/Source/MQTTnet/Buffers/MqttPayloadOwner.cs +++ b/Source/MQTTnet/Buffers/MqttPayloadOwner.cs @@ -11,7 +11,7 @@ namespace MQTTnet.Buffers /// Owner of that is responsible /// for disposing the underlying payload appropriately. /// - public struct MqttPayloadOwner : IReadOnlySequenceOwner + public class MqttPayloadOwner : IReadOnlySequenceOwner { public MqttPayloadOwner() {