1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-16 15:16:33 +09:00

Initializing ping to random start to make network stream more unpredictable

This commit is contained in:
lidgren
2010-12-09 07:56:34 +00:00
parent 2e78b3e685
commit be902b8010
5 changed files with 14 additions and 2 deletions

View File

@@ -14,6 +14,14 @@ namespace Lidgren.Network
/// </summary>
public float AverageRoundtripTime { get { return m_averageRoundtripTime; } }
internal void InitializePing()
{
// randomize ping sent time (0.25 - 1.0 x ping interval)
m_sentPingTime = (float)NetTime.Now;
m_sentPingTime -= (m_peerConfiguration.PingInterval * 0.25f); // delay ping for a little while
m_sentPingTime -= (NetRandom.Instance.NextSingle() * (m_peerConfiguration.PingInterval * 0.75f));
}
internal void SendPing()
{
m_peer.VerifyNetworkThread();