Browse Source

Dispose queue in managed client.

release/3.x.x
Christian Kratky 5 years ago
parent
commit
3ff5806dbb
2 changed files with 7 additions and 1 deletions
  1. +1
    -0
      Source/MQTTnet.Extensions.ManagedClient/ManagedMqttClient.cs
  2. +6
    -1
      Source/MQTTnet/Internal/BlockingQueue.cs

+ 1
- 0
Source/MQTTnet.Extensions.ManagedClient/ManagedMqttClient.cs View File

@@ -252,6 +252,7 @@ namespace MQTTnet.Extensions.ManagedClient
_maintainConnectionTask = null;
}

_messageQueue.Dispose();
_messageQueueLock.Dispose();
_mqttClient.Dispose();
}


+ 6
- 1
Source/MQTTnet/Internal/BlockingQueue.cs View File

@@ -4,7 +4,7 @@ using System.Threading;

namespace MQTTnet.Internal
{
public class BlockingQueue<TItem>
public class BlockingQueue<TItem> : IDisposable
{
private readonly object _syncRoot = new object();
private readonly LinkedList<TItem> _items = new LinkedList<TItem>();
@@ -108,5 +108,10 @@ namespace MQTTnet.Internal
_items.Clear();
}
}

public void Dispose()
{
_gate.Dispose();
}
}
}

Loading…
Cancel
Save