Преглед на файлове

Merge pull request #35 from JanEggers/BugFixMsgDispatcher

Bug fixes in msg dispatcher
release/3.x.x
Christian преди 7 години
committed by GitHub
родител
ревизия
f7a8b764d0
променени са 1 файла, в които са добавени 3 реда и са изтрити 3 реда
  1. +3
    -3
      MQTTnet.Core/Client/MqttPacketDispatcher.cs

+ 3
- 3
MQTTnet.Core/Client/MqttPacketDispatcher.cs Целия файл

@@ -10,7 +10,7 @@ namespace MQTTnet.Core.Client
public class MqttPacketDispatcher
{
private readonly object _syncRoot = new object();
private readonly List<MqttBasePacket> _receivedPackets = new List<MqttBasePacket>();
private readonly HashSet<MqttBasePacket> _receivedPackets = new HashSet<MqttBasePacket>();
private readonly List<MqttPacketAwaiter> _packetAwaiters = new List<MqttPacketAwaiter>();

public async Task<MqttBasePacket> WaitForPacketAsync(Func<MqttBasePacket, bool> selector, TimeSpan timeout)
@@ -41,7 +41,7 @@ namespace MQTTnet.Core.Client
{
if (packetAwaiter.PacketSelector(packet))
{
packetAwaiter.SetResult(packet);
packetAwaiter.TrySetResult(packet);
packetDispatched = true;
break;
}
@@ -71,7 +71,7 @@ namespace MQTTnet.Core.Client

private List<MqttPacketAwaiter> GetPacketAwaiters()
{
lock (_packetAwaiters)
lock (_syncRoot)
{
return new List<MqttPacketAwaiter>(_packetAwaiters);
}


Зареждане…
Отказ
Запис