mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-23 13:23:05 +08:00
Moved undeliveredMessageInterceptor to local variable to avoid threading issues.
This commit is contained in:
@@ -238,12 +238,14 @@ namespace MQTTnet.Server
|
|||||||
|
|
||||||
if (deliveryCount == 0)
|
if (deliveryCount == 0)
|
||||||
{
|
{
|
||||||
if (_options.UndeliveredMessageInterceptor == null)
|
var undeliveredMessageInterceptor = _options.UndeliveredMessageInterceptor;
|
||||||
|
|
||||||
|
if (undeliveredMessageInterceptor == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await _options.UndeliveredMessageInterceptor.InterceptApplicationMessagePublishAsync(new MqttApplicationMessageInterceptorContext(sender?.ClientId, sender?.Session?.Items, applicationMessage));
|
await undeliveredMessageInterceptor.InterceptApplicationMessagePublishAsync(new MqttApplicationMessageInterceptorContext(sender?.ClientId, sender?.Session?.Items, applicationMessage));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (OperationCanceledException)
|
catch (OperationCanceledException)
|
||||||
|
|||||||
Reference in New Issue
Block a user