|
@@ -300,7 +300,7 @@ namespace MQTTnet.Extensions.ManagedClient |
|
|
//in the queue is equal to this message, then it's safe to remove |
|
|
//in the queue is equal to this message, then it's safe to remove |
|
|
//it from the queue. If not, that means this.PublishAsync has already |
|
|
//it from the queue. If not, that means this.PublishAsync has already |
|
|
//removed it, in which case we don't want to do anything. |
|
|
//removed it, in which case we don't want to do anything. |
|
|
_messageQueue.RemoveFirstIfEqual(message, IdsAreEqual); |
|
|
|
|
|
|
|
|
_messageQueue.RemoveFirst(i => i.Id.Equals(message.Id)); |
|
|
} |
|
|
} |
|
|
_storageManager?.RemoveAsync(message).GetAwaiter().GetResult(); |
|
|
_storageManager?.RemoveAsync(message).GetAwaiter().GetResult(); |
|
|
} |
|
|
} |
|
@@ -321,7 +321,7 @@ namespace MQTTnet.Extensions.ManagedClient |
|
|
//with prior behavior in that way. |
|
|
//with prior behavior in that way. |
|
|
lock (_messageQueue) //lock to avoid conflict with this.PublishAsync |
|
|
lock (_messageQueue) //lock to avoid conflict with this.PublishAsync |
|
|
{ |
|
|
{ |
|
|
_messageQueue.RemoveFirstIfEqual(message, IdsAreEqual); |
|
|
|
|
|
|
|
|
_messageQueue.RemoveFirst(i => i.Id.Equals(message.Id)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@@ -335,11 +335,6 @@ namespace MQTTnet.Extensions.ManagedClient |
|
|
ApplicationMessageProcessed?.Invoke(this, new ApplicationMessageProcessedEventArgs(message, transmitException)); |
|
|
ApplicationMessageProcessed?.Invoke(this, new ApplicationMessageProcessedEventArgs(message, transmitException)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private static bool IdsAreEqual(ManagedMqttApplicationMessage message1, ManagedMqttApplicationMessage message2) |
|
|
|
|
|
{ |
|
|
|
|
|
return message1.Id.Equals(message2.Id); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private async Task SynchronizeSubscriptionsAsync() |
|
|
private async Task SynchronizeSubscriptionsAsync() |
|
|
{ |
|
|
{ |
|
|