From 8fd3e5070dd3c95148c7e22843300d594da87f89 Mon Sep 17 00:00:00 2001 From: Eggers Jan Date: Mon, 11 Sep 2017 13:01:24 +0200 Subject: [PATCH] add missing await --- MQTTnet.Core/Serializer/MqttPacketSerializer.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/MQTTnet.Core/Serializer/MqttPacketSerializer.cs b/MQTTnet.Core/Serializer/MqttPacketSerializer.cs index 6f2c9ff..78c3cc0 100644 --- a/MQTTnet.Core/Serializer/MqttPacketSerializer.cs +++ b/MQTTnet.Core/Serializer/MqttPacketSerializer.cs @@ -38,6 +38,7 @@ namespace MQTTnet.Core.Serializer Buffer.BlockCopy( body, 0, writeBuffer, headerArray.Length, body.Length ); _sendTask = Send( writeBuffer, destination ); + await _sendTask.ConfigureAwait( false ); } } @@ -286,14 +287,8 @@ namespace MQTTnet.Core.Serializer var retain = fixedHeader.Read(); var qualityOfServiceLevel = (MqttQualityOfServiceLevel)fixedHeader.Read(2); var dup = fixedHeader.Read(); - - - var length = reader.ReadUInt16(); - if (length != 5) - { - - } - var topic = Encoding.UTF8.GetString( reader.ReadBytes( length ), 0, length ); + + var topic = reader.ReadStringWithLengthPrefix(); ushort packetIdentifier = 0; if (qualityOfServiceLevel > MqttQualityOfServiceLevel.AtMostOnce)