Skip to content

Commit

Permalink
Merge pull request #75 from jctwood/latency-display
Browse files Browse the repository at this point in the history
Add debug log for latency on server
  • Loading branch information
Cheeseness committed Apr 24, 2017
2 parents c120753 + 9b75078 commit 1253b4c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Assets/scripts/utils/TableNetworking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,29 @@ public class TableNetworking : NetworkBehaviour
[SyncVar]
public bool selected;

public float logPingFrequency = 5.0f;

[ServerCallback]
void Start ()
{
selected = false;
table = "";
variant = "";

InvokeRepeating("LogPing", 0.0f, logPingFrequency);
}

void OnClientConnect(NetworkConnection conn)
{
InvokeRepeating("LogPing", 0.0f, logPingFrequency);
}

void LogPing()
{
foreach (NetworkClient conn in NetworkClient.allClients)
{
Debug.Log("Ping for connection " + conn.connection.address.ToString() + ": " + conn.GetRTT().ToString() + " (ms)");
}
}

public string GetTable()
Expand Down

0 comments on commit 1253b4c

Please sign in to comment.