mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-19 19:13:11 +08:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user