This commit is contained in:
2026-09-03 04:31:37 +03:00
parent 61ec566f63
commit 69a50d8b20
4 changed files with 281 additions and 0 deletions
+34
View File
@@ -321,6 +321,12 @@ public partial class EpConnection : NetworkConnection, IStore
return;
Global.Counters["Ep Sent Packets"]++;
var metrics = _runtimeMetrics;
if (metrics != null)
{
Interlocked.Add(ref metrics.SentBytes, data.LongLength);
Interlocked.Increment(ref metrics.SentPackets);
}
if (_outboundProtectionState == OutboundProtectionState.Encrypted)
base.Send(ComposeEncryptedRecord(data));
@@ -1343,6 +1349,30 @@ public partial class EpConnection : NetworkConnection, IStore
{
offset += (uint)rt;
var metrics = _runtimeMetrics;
if (metrics != null)
{
Interlocked.Increment(ref metrics.ReceivedPackets);
if (_packet.Method == EpPacketMethod.Request)
Interlocked.Increment(ref metrics.ReceivedRequests);
else if (_packet.Method == EpPacketMethod.Reply)
{
Interlocked.Increment(ref metrics.ReceivedReplies);
if (_packet.Reply == EpPacketReply.PermissionError ||
_packet.Reply == EpPacketReply.ExecutionError ||
_packet.Reply == EpPacketReply.Warning)
Interlocked.Increment(ref metrics.ReceivedErrors);
}
else if (_packet.Method == EpPacketMethod.Notification)
{
Interlocked.Increment(ref metrics.ReceivedNotifications);
if (_packet.Notification == EpPacketNotification.PropertyModified)
Interlocked.Increment(ref metrics.ReceivedPropertyModifications);
else if (_packet.Notification == EpPacketNotification.EventOccurred)
Interlocked.Increment(ref metrics.ReceivedEvents);
}
}
if (_packet.Tdu == null &&
_packet.Method != EpPacketMethod.Reply &&
_packet.Method != EpPacketMethod.Extension)
@@ -3022,6 +3052,10 @@ public partial class EpConnection : NetworkConnection, IStore
if (msg == null)
return;
var metrics = _runtimeMetrics;
if (metrics != null)
Interlocked.Add(ref metrics.ReceivedBytes, msg.LongLength);
this.Socket.Hold();
try