mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-16 17:23:04 +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 (_options.UndeliveredMessageInterceptor == null)
|
||||
var undeliveredMessageInterceptor = _options.UndeliveredMessageInterceptor;
|
||||
|
||||
if (undeliveredMessageInterceptor == null)
|
||||
{
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user