瀏覽代碼

Dispose queue in managed client.

release/3.x.x
Christian Kratky 5 年之前
父節點
當前提交
3ff5806dbb
共有 2 個文件被更改,包括 7 次插入1 次删除
  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 查看文件

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

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


+ 6
- 1
Source/MQTTnet/Internal/BlockingQueue.cs 查看文件

@@ -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…
取消
儲存