Change behavior of NoMatchingSubscribers (#1975)

Change behavior of NoMatchingSubscribers.
This commit is contained in:
Christian
2024-04-26 18:35:39 +02:00
committed by GitHub
parent 1aa91e3828
commit 4ab956abd1
2 changed files with 7 additions and 1 deletions
@@ -257,7 +257,12 @@ namespace MQTTnet.Server
if (matchingSubscribersCount == 0)
{
reasonCode = (int)MqttPubAckReasonCode.NoMatchingSubscribers;
if (reasonCode == (int)MqttPubAckReasonCode.Success)
{
// Only change the value if it was success. Otherwise, we would hide an error or not authorized status.
reasonCode = (int)MqttPubAckReasonCode.NoMatchingSubscribers;
}
await FireApplicationMessageNotConsumedEvent(applicationMessage, senderId).ConfigureAwait(false);
}
}