Fix integer overflow breaking Lidgren metrics.

This commit is contained in:
Pieter-Jan Briers
2021-03-25 01:47:32 +01:00
parent 39ae3ac653
commit 765a560380
3 changed files with 12 additions and 12 deletions

View File

@@ -94,8 +94,8 @@ namespace Robust.Server
private IGameLoop _mainLoop = default!;
private TimeSpan _lastTitleUpdate;
private int _lastReceivedBytes;
private int _lastSentBytes;
private long _lastReceivedBytes;
private long _lastSentBytes;
private string? _shutdownReason;

View File

@@ -177,10 +177,10 @@ namespace Robust.Shared.Network
{
get
{
var sentPackets = 0;
var sentBytes = 0;
var recvPackets = 0;
var recvBytes = 0;
var sentPackets = 0L;
var sentBytes = 0L;
var recvPackets = 0L;
var recvBytes = 0L;
foreach (var peer in _netPeers)
{
@@ -1155,24 +1155,24 @@ namespace Robust.Shared.Network
/// <summary>
/// Total sent bytes.
/// </summary>
public readonly int SentBytes;
public readonly long SentBytes;
/// <summary>
/// Total received bytes.
/// </summary>
public readonly int ReceivedBytes;
public readonly long ReceivedBytes;
/// <summary>
/// Total sent packets.
/// </summary>
public readonly int SentPackets;
public readonly long SentPackets;
/// <summary>
/// Total received packets.
/// </summary>
public readonly int ReceivedPackets;
public readonly long ReceivedPackets;
public NetworkStats(int sentBytes, int receivedBytes, int sentPackets, int receivedPackets)
public NetworkStats(long sentBytes, long receivedBytes, long sentPackets, long receivedPackets)
{
SentBytes = sentBytes;
ReceivedBytes = receivedBytes;