You've already forked lidgren-network-gen3
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user