Skip to content

Commit

Permalink
Add debug log for latency on server
Browse files Browse the repository at this point in the history
  • Loading branch information
jctwizard committed Apr 24, 2017
1 parent bf5c3e8 commit 9b75078
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 9b75078

Please sign in to comment.