Skip to content

Commit

Permalink
feat: adding sequence size of metrics to inspector
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Frowen committed Oct 1, 2021
1 parent 85e1dbf commit c7a21dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Assets/Mirage/Runtime/NetworkClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class NetworkClient : MonoBehaviour, INetworkClient
static readonly ILogger logger = LogFactory.GetLogger(typeof(NetworkClient));

public bool EnablePeerMetrics;
[Tooltip("Sequence size of buffer in bits.\n10 => array size 1024 => ~17 seconds at 60hz")]
public int MetricsSize = 10;
public Metrics Metrics { get; private set; }

/// <summary>
Expand Down Expand Up @@ -116,7 +118,7 @@ public void Connect(string address = null, ushort? port = null)
ISocket socket = SocketFactory.CreateClientSocket();
MessageHandler = new MessageHandler(World, DisconnectOnException);
var dataHandler = new DataHandler(MessageHandler);
Metrics = EnablePeerMetrics ? new Metrics() : null;
Metrics = EnablePeerMetrics ? new Metrics(MetricsSize) : null;

Config config = PeerConfig ?? new Config();

Expand Down
4 changes: 3 additions & 1 deletion Assets/Mirage/Runtime/NetworkServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class NetworkServer : MonoBehaviour, INetworkServer
static readonly ILogger logger = LogFactory.GetLogger(typeof(NetworkServer));

public bool EnablePeerMetrics;
[Tooltip("Sequence size of buffer in bits.\n10 => array size 1024 => ~17 seconds at 60hz")]
public int MetricsSize = 10;
public Metrics Metrics { get; private set; }

/// <summary>
Expand Down Expand Up @@ -197,7 +199,7 @@ public void StartServer(NetworkClient localClient = null)

ISocket socket = SocketFactory.CreateServerSocket();
var dataHandler = new DataHandler(MessageHandler, connections);
Metrics = EnablePeerMetrics ? new Metrics() : null;
Metrics = EnablePeerMetrics ? new Metrics(MetricsSize) : null;
Config config = PeerConfig ?? new Config
{
MaxConnections = MaxConnections,
Expand Down

0 comments on commit c7a21dd

Please sign in to comment.