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

KeepAliveDelay removed; ping frequency doubled instead if no activity in 1.5 x ping frequency

This commit is contained in:
lidgren
2010-06-24 11:23:36 +00:00
parent 77d480e3cb
commit 51a4bfa5ea
5 changed files with 17 additions and 21 deletions

View File

@@ -111,10 +111,6 @@ namespace Lidgren.Network
if (m_status == NetConnectionStatus.Disconnected || m_status == NetConnectionStatus.None)
return;
// in case of inactivity; send forced keepalive/ping
if (now > m_lastSendRespondedTo + m_peerConfiguration.m_keepAliveDelay)
m_nextPing = now;
// force ack sending?
if (now > m_nextForceAckTime)
{
@@ -141,7 +137,12 @@ namespace Lidgren.Network
now = NetTime.Now; // need exact number
m_lastSentPingNumber++;
m_lastPingSendTime = now;
m_nextPing = now + m_owner.Configuration.m_pingFrequency;
// in case of not heard for a while
if (now > m_lastSendRespondedTo + (m_owner.Configuration.m_pingFrequency * 1.5f))
m_nextPing = now + (m_owner.Configuration.m_pingFrequency * 0.5f); // double ping rate
else
m_nextPing = now + m_owner.Configuration.m_pingFrequency;
NetOutgoingMessage ping = m_owner.CreateMessage(1);
ping.m_libType = NetMessageLibraryType.Ping;