diff --git a/Source/MQTTnet.Extensions.ManagedClient/ManagedMqttClient.cs b/Source/MQTTnet.Extensions.ManagedClient/ManagedMqttClient.cs index 0607d93..50310be 100644 --- a/Source/MQTTnet.Extensions.ManagedClient/ManagedMqttClient.cs +++ b/Source/MQTTnet.Extensions.ManagedClient/ManagedMqttClient.cs @@ -252,6 +252,7 @@ namespace MQTTnet.Extensions.ManagedClient _maintainConnectionTask = null; } + _messageQueue.Dispose(); _messageQueueLock.Dispose(); _mqttClient.Dispose(); } diff --git a/Source/MQTTnet/Internal/BlockingQueue.cs b/Source/MQTTnet/Internal/BlockingQueue.cs index 871c40a..6225105 100644 --- a/Source/MQTTnet/Internal/BlockingQueue.cs +++ b/Source/MQTTnet/Internal/BlockingQueue.cs @@ -4,7 +4,7 @@ using System.Threading; namespace MQTTnet.Internal { - public class BlockingQueue + public class BlockingQueue : IDisposable { private readonly object _syncRoot = new object(); private readonly LinkedList _items = new LinkedList(); @@ -108,5 +108,10 @@ namespace MQTTnet.Internal _items.Clear(); } } + + public void Dispose() + { + _gate.Dispose(); + } } }