Adjust the MqttClientPendingMessagesQueue and the MqttPacketReader to use asynchronous methods for long-running/blocking operations.

Otherwise, Worker Threads from the .NET Threadpool are blocked while waiting for the next client message, and while waiting for the next message to send.
This commit is contained in:
kpreisser
2018-01-17 11:10:39 +01:00
parent 312773d054
commit e1a9aa7d03
3 changed files with 25 additions and 16 deletions
@@ -120,7 +120,7 @@ namespace MQTTnet.Adapter
private static async Task<ReceivedMqttPacket> ReceiveAsync(Stream stream, CancellationToken cancellationToken)
{
var header = MqttPacketReader.ReadHeaderFromSource(stream, cancellationToken);
var header = await MqttPacketReader.ReadHeaderFromSourceAsync(stream, cancellationToken);
if (header == null)
{
return null;