1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-18 08:06:33 +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) switch (libType)
{ {
case NetMessageLibraryType.Connect: case NetMessageLibraryType.Connect:
m_owner.LogDebug("Received Connect");
if (m_status == NetConnectionStatus.Connecting) if (m_status == NetConnectionStatus.Connecting)
{ {
// our connectresponse must have been lost, send another one // our connectresponse must have been lost, send another one
SendConnectResponse(); SendConnectResponse();
return; return;
} }
if (m_connectionInitiator)
m_owner.LogError("NetConnection.HandleIncomingHandshake() passed LibraryConnect but status is " + m_status + "!?"); 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; break;
case NetMessageLibraryType.ConnectResponse: case NetMessageLibraryType.ConnectResponse:
if (!m_connectionInitiator) if (!m_connectionInitiator)
@@ -194,6 +199,8 @@ namespace Lidgren.Network
return; return;
} }
m_owner.LogDebug("Received ConnectResponse");
if (m_status == NetConnectionStatus.Connecting) if (m_status == NetConnectionStatus.Connecting)
{ {
m_owner.m_statistics.m_bytesAllocated += NetUtility.BytesToHoldBits(payloadBitsLength); 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); m_owner.LogWarning("NetConnection.HandleIncomingHandshake() passed " + libType + ", but status is " + m_status);
break; break;
case NetMessageLibraryType.ConnectionEstablished: case NetMessageLibraryType.ConnectionEstablished:
m_owner.LogDebug("Received ConnectionEstablished");
if (!m_connectionInitiator && m_status == NetConnectionStatus.Connecting) if (!m_connectionInitiator && m_status == NetConnectionStatus.Connecting)
{ {
float remoteNetTime = BitConverter.ToSingle(m_owner.m_receiveBuffer, ptr); float remoteNetTime = BitConverter.ToSingle(m_owner.m_receiveBuffer, ptr);

View File

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

View File

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