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

Debug messages added

This commit is contained in:
lidgren
2010-08-29 11:04:45 +00:00
parent d85ca4f2fb
commit bdfdbb3601
3 changed files with 14 additions and 5 deletions

View File

@@ -177,14 +177,19 @@ namespace Lidgren.Network
switch (libType)
{
case NetMessageLibraryType.Connect:
m_owner.LogDebug("Received Connect");
if (m_status == NetConnectionStatus.Connecting)
{
// our connectresponse must have been lost, send another one
SendConnectResponse();
return;
}
m_owner.LogError("NetConnection.HandleIncomingHandshake() passed LibraryConnect but status is " + m_status + "!?");
if (m_connectionInitiator)
m_owner.LogError("Received Connect; altho we're connect initiator! Status is " + m_status);
else
m_owner.LogError("NetConnection.HandleIncomingHandshake() passed LibraryConnect but status is " + m_status + "!? now is " + NetTime.Now + " LastHeardFrom is " + m_lastHeardFrom);
break;
case NetMessageLibraryType.ConnectResponse:
if (!m_connectionInitiator)
@@ -194,6 +199,8 @@ namespace Lidgren.Network
return;
}
m_owner.LogDebug("Received ConnectResponse");
if (m_status == NetConnectionStatus.Connecting)
{
m_owner.m_statistics.m_bytesAllocated += NetUtility.BytesToHoldBits(payloadBitsLength);
@@ -221,6 +228,9 @@ namespace Lidgren.Network
m_owner.LogWarning("NetConnection.HandleIncomingHandshake() passed " + libType + ", but status is " + m_status);
break;
case NetMessageLibraryType.ConnectionEstablished:
m_owner.LogDebug("Received ConnectionEstablished");
if (!m_connectionInitiator && m_status == NetConnectionStatus.Connecting)
{
float remoteNetTime = BitConverter.ToSingle(m_owner.m_receiveBuffer, ptr);

View File

@@ -139,7 +139,7 @@ namespace Lidgren.Network
m_lastPingSendTime = now;
// in case of not heard for a while
if (now > m_lastSendRespondedTo + (m_owner.Configuration.m_pingFrequency * 1.5f))
if (m_lastSendRespondedTo > 0 && (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;
@@ -149,7 +149,6 @@ namespace Lidgren.Network
ping.Write((byte)m_lastSentPingNumber);
m_owner.SendLibraryImmediately(ping, m_remoteEndpoint);
}
}
}

View File

@@ -93,7 +93,7 @@ namespace Lidgren.Network
m_unsentMessages = new NetQueue<NetSending>(8);
double now = NetTime.Now;
m_nextPing = now + 5.0f;
m_nextPing = now + 10.0f;
m_nextForceAckTime = double.MaxValue;
m_lastSentUnsentMessages = now;
m_lastSendRespondedTo = now;