Extend server client ResetStatistics() to reset all client statistics not only channel... (#1587)

Extend reset client statistic to reset all stats
This commit is contained in:
Dalibor Kundrat
2022-11-26 14:47:17 +01:00
committed by GitHub
parent 581a024ceb
commit b5952a590a
2 changed files with 8 additions and 1 deletions
@@ -83,6 +83,7 @@ namespace MQTTnet.Server
public void ResetStatistics() public void ResetStatistics()
{ {
ChannelAdapter.ResetStatistics(); ChannelAdapter.ResetStatistics();
Statistics.ResetStatistics();
} }
public async Task RunAsync() public async Task RunAsync()
@@ -73,6 +73,12 @@ namespace MQTTnet.Server
LastNonKeepAlivePacketReceivedTimestamp = LastPacketReceivedTimestamp; LastNonKeepAlivePacketReceivedTimestamp = LastPacketReceivedTimestamp;
} }
} }
public void ResetStatistics(){
Interlocked.Exchange(ref _sentApplicationMessagesCount,0);
Interlocked.Exchange(ref _receivedApplicationMessagesCount,0);
Interlocked.Exchange(ref _sentPacketsCount,0);
Interlocked.Exchange(ref _receivedPacketsCount,0);
}
public void HandleSentPacket(MqttPacket packet) public void HandleSentPacket(MqttPacket packet)
{ {