mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-22 12:53:04 +08:00
Add support for reset of connection statistics. Refactor keep alive monitor.
This commit is contained in:
@@ -14,7 +14,7 @@ using MQTTnet.Server.Status;
|
||||
|
||||
namespace MQTTnet.Server
|
||||
{
|
||||
public class MqttClientConnection : IMqttClientSession, IDisposable
|
||||
public class MqttClientConnection : IDisposable
|
||||
{
|
||||
private readonly MqttPacketIdentifierProvider _packetIdentifierProvider = new MqttPacketIdentifierProvider();
|
||||
private readonly MqttPacketDispatcher _packetDispatcher = new MqttPacketDispatcher();
|
||||
@@ -64,7 +64,7 @@ namespace MQTTnet.Server
|
||||
if (logger == null) throw new ArgumentNullException(nameof(logger));
|
||||
_logger = logger.CreateChildLogger(nameof(MqttClientConnection));
|
||||
|
||||
_keepAliveMonitor = new MqttClientKeepAliveMonitor(this, _logger);
|
||||
_keepAliveMonitor = new MqttClientKeepAliveMonitor(_connectPacket.ClientId, StopAsync, _logger);
|
||||
|
||||
_connectedTimestamp = DateTime.UtcNow;
|
||||
_lastPacketReceivedTimestamp = _connectedTimestamp;
|
||||
@@ -86,6 +86,11 @@ namespace MQTTnet.Server
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetStatistics()
|
||||
{
|
||||
_channelAdapter.ResetStatistics();
|
||||
}
|
||||
|
||||
public void FillStatus(MqttClientStatus status)
|
||||
{
|
||||
status.ClientId = ClientId;
|
||||
|
||||
Reference in New Issue
Block a user