From 7297336786ad5e0e391c2606cf50f38c438e5d40 Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 26 Oct 2021 22:12:34 +0200 Subject: [PATCH] Fix packet bus cancellation. --- Source/MQTTnet/Internal/MqttPacketBus.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/MQTTnet/Internal/MqttPacketBus.cs b/Source/MQTTnet/Internal/MqttPacketBus.cs index 986beed0..446c26a6 100644 --- a/Source/MQTTnet/Internal/MqttPacketBus.cs +++ b/Source/MQTTnet/Internal/MqttPacketBus.cs @@ -99,6 +99,8 @@ namespace MQTTnet.Internal // the worker back to the thread pool. await _semaphore.WaitAsync(cancellationToken).ConfigureAwait(false); } + + cancellationToken.ThrowIfCancellationRequested(); throw new InvalidOperationException("MqttPacketBus is broken."); }