mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-16 17:23:04 +08:00
Fix serialization issue of MQTTv5 PubRec packet.
This commit is contained in:
@@ -5,15 +5,25 @@
|
||||
int Length { get; }
|
||||
|
||||
void WriteWithLengthPrefix(string value);
|
||||
void Write(byte returnCode);
|
||||
void WriteWithLengthPrefix(byte[] payload);
|
||||
void Write(ushort keepAlivePeriod);
|
||||
void Write(IMqttPacketWriter propertyWriter);
|
||||
void WriteVariableLengthInteger(uint length);
|
||||
void Write(byte[] payload, int v, int length);
|
||||
void Reset(int v);
|
||||
void Seek(int v);
|
||||
|
||||
void Write(byte value);
|
||||
|
||||
void WriteWithLengthPrefix(byte[] value);
|
||||
|
||||
void Write(ushort value);
|
||||
|
||||
void Write(IMqttPacketWriter value);
|
||||
|
||||
void WriteVariableLengthInteger(uint value);
|
||||
|
||||
void Write(byte[] value, int offset, int length);
|
||||
|
||||
void Reset(int length);
|
||||
|
||||
void Seek(int offset);
|
||||
|
||||
void FreeBuffer();
|
||||
|
||||
byte[] GetBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,10 +328,7 @@ namespace MQTTnet.Formatter.V5
|
||||
{
|
||||
ThrowReasonCodeNotSetException();
|
||||
}
|
||||
|
||||
packetWriter.Write(packet.PacketIdentifier.Value);
|
||||
packetWriter.Write((byte)packet.ReasonCode.Value);
|
||||
|
||||
|
||||
var propertiesWriter = new MqttV500PropertiesWriter();
|
||||
if (packet.Properties != null)
|
||||
{
|
||||
@@ -339,6 +336,8 @@ namespace MQTTnet.Formatter.V5
|
||||
propertiesWriter.WriteUserProperties(packet.Properties.UserProperties);
|
||||
}
|
||||
|
||||
packetWriter.Write(packet.PacketIdentifier.Value);
|
||||
|
||||
if (packetWriter.Length > 0 || packet.ReasonCode.Value != MqttPubRecReasonCode.Success)
|
||||
{
|
||||
packetWriter.Write((byte)packet.ReasonCode.Value);
|
||||
|
||||
Reference in New Issue
Block a user