mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-06 21:38:32 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
55 lines
1.4 KiB
C#
55 lines
1.4 KiB
C#
namespace Sandbox.Network;
|
|
|
|
public struct ConnectionStats
|
|
{
|
|
/// <summary>
|
|
/// Current ping for this connection.
|
|
/// </summary>
|
|
public int Ping { get; set; }
|
|
|
|
/// <summary>
|
|
/// How many packets per second we're sending to this connection.
|
|
/// </summary>
|
|
public float OutPacketsPerSecond { get; set; }
|
|
|
|
/// <summary>
|
|
/// How many bytes per second we're sending to this connection.
|
|
/// </summary>
|
|
public float OutBytesPerSecond { get; set; }
|
|
|
|
/// <summary>
|
|
/// How many packets per second we're receiving from this connection.
|
|
/// </summary>
|
|
public float InPacketsPerSecond { get; set; }
|
|
|
|
/// <summary>
|
|
/// How many bytes per second we're receiving from this connection.
|
|
/// </summary>
|
|
public float InBytesPerSecond { get; set; }
|
|
|
|
/// <summary>
|
|
/// Estimate rate that we believe we can send data to this connection.
|
|
/// </summary>
|
|
public int SendRateBytesPerSecond { get; set; }
|
|
|
|
/// <summary>
|
|
/// From 0 to 1 how good is our connection to this?
|
|
/// </summary>
|
|
public float ConnectionQuality { get; set; }
|
|
|
|
private string Name { get; set; }
|
|
|
|
internal ConnectionStats( string name )
|
|
{
|
|
Name = name;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
if ( string.IsNullOrEmpty( Name ) )
|
|
return $"ConnectionStats( OutBps: {OutBytesPerSecond}, InBps: {InBytesPerSecond}, Quality: {ConnectionQuality}";
|
|
else
|
|
return $"ConnectionStats( {Name}, OutBps: {OutBytesPerSecond}, InBps: {InBytesPerSecond}, Quality: {ConnectionQuality}";
|
|
}
|
|
}
|