Skip to content

Commit

Permalink
Fix minor bug in MqttV5PacketEncoder.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Y-Sindo authored Feb 29, 2024
1 parent f82d382 commit 6a20c76
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Source/MQTTnet/Formatter/V5/MqttV5PacketEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ byte EncodePubAckPacket(MqttPubAckPacket packet)
_propertiesWriter.WriteReasonString(packet.ReasonString);
_propertiesWriter.WriteUserProperties(packet.UserProperties);

if (_bufferWriter.Length > 0 || packet.ReasonCode != MqttPubAckReasonCode.Success)
if (_propertiesWriter.Length > 0 || packet.ReasonCode != MqttPubAckReasonCode.Success)
{
_bufferWriter.WriteByte((byte)packet.ReasonCode);
_propertiesWriter.WriteTo(_bufferWriter);
Expand Down Expand Up @@ -375,7 +375,7 @@ byte EncodePubRecPacket(MqttPubRecPacket packet)

_bufferWriter.WriteTwoByteInteger(packet.PacketIdentifier);

if (_bufferWriter.Length > 0 || packet.ReasonCode != MqttPubRecReasonCode.Success)
if (_propertiesWriter.Length > 0 || packet.ReasonCode != MqttPubRecReasonCode.Success)
{
_bufferWriter.WriteByte((byte)packet.ReasonCode);
_propertiesWriter.WriteTo(_bufferWriter);
Expand Down Expand Up @@ -534,4 +534,4 @@ static void ThrowIfPacketIdentifierIsInvalid(ushort packetIdentifier, MqttPacket
}
}
}
}
}

0 comments on commit 6a20c76

Please sign in to comment.