mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-21 12:16:02 +08:00
Add overflow strategy for pending messages queue.
This commit is contained in:
@@ -147,10 +147,7 @@ namespace MQTTnet.Server
|
||||
{
|
||||
publishPacket.PacketIdentifier = _packetIdentifierProvider.GetNewPacketIdentifier();
|
||||
}
|
||||
if (_options.MaxPendingMessagesPerClient <= PendingMessagesQueue.Count)
|
||||
{
|
||||
await PendingMessagesQueue.DropPacket();
|
||||
}
|
||||
|
||||
PendingMessagesQueue.Enqueue(publishPacket);
|
||||
}
|
||||
|
||||
@@ -276,7 +273,7 @@ namespace MQTTnet.Server
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
|
||||
_logger.Warning<MqttClientSession>("Client '{0}': Received not supported packet ({1}). Closing connection.", ClientId, packet);
|
||||
_logger.Warning(this, null, "Client '{0}': Received not supported packet ({1}). Closing connection.", ClientId, packet);
|
||||
Stop(MqttClientDisconnectType.NotClean);
|
||||
|
||||
return Task.FromResult(0);
|
||||
|
||||
Reference in New Issue
Block a user