Skip to content

Commit

Permalink
Exposed avg rtt and mtu in network client
Browse files Browse the repository at this point in the history
  • Loading branch information
leonidumanskiy committed Oct 1, 2023
1 parent b503106 commit 42a6ef8
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion source/Fenrir.Multiplayer/Fenrir.Multiplayer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>Fenrir Multiplayer Library</Description>
<Version>1.0.13</Version>
<Version>1.0.14</Version>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

Expand Down
9 changes: 9 additions & 0 deletions source/UnityPackage/Assets/Runtime/Client/NetworkClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,15 @@ public int SimulatedMaxLatency
set => _liteNetProtocolConnector.SimulationMaxLatency = value;
}

/// <summary>
/// Average round trip time, ms
/// </summary>
public int RoundTripTime => _liteNetProtocolConnector.RoundTripTime;

/// <summary>
/// MTU, bytes
/// </summary>
public int Mtu => _liteNetProtocolConnector.Mtu;

/// <summary>
/// Creates new Network Client
Expand Down
10 changes: 10 additions & 0 deletions source/UnityPackage/Assets/Runtime/LiteNet/LiteNetBasePeer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ class LiteNetBasePeer
/// </summary>
public EndPoint EndPoint => NetPeer.EndPoint;

/// <summary>
/// Average Round trip time
/// </summary>
public int RoundTripTime => NetPeer?.RoundTripTime ?? 0;

/// <summary>
/// MTU
/// </summary>
public int Mtu => NetPeer?.Mtu ?? 0;

/// <summary>
/// If set to true, outgoing messages will contain debug info.
/// Setting this to true affects performance and should be disabled in production builds.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,12 @@ public int SimulationMaxLatency
set => _netManager.SimulationMaxLatency = value;
}

///<inheritdoc/>
public int RoundTripTime => _peer?.RoundTripTime ?? 0;

///<inheritdoc/>
public int Mtu => _peer?.Mtu ?? 0;

/// <summary>
/// TaskCompletionSource that represents connection task
/// </summary>
Expand Down
10 changes: 10 additions & 0 deletions source/UnityPackage/Assets/Runtime/Network/IProtocolConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ public interface IProtocolConnector : IDisposable
/// </summary>
int SimulationMaxLatency { get; set; }

/// <summary>
/// Average round trip time
/// </summary>
int RoundTripTime { get; }

/// <summary>
/// MTU
/// </summary>
int Mtu { get; }

/// <summary>
/// Connects using protocol-specific implementation
/// </summary>
Expand Down

0 comments on commit 42a6ef8

Please sign in to comment.