1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-13 21:56:29 +09:00

Tweaks + debug messages

This commit is contained in:
lidgren
2010-09-07 06:35:09 +00:00
parent 4c9e1df96b
commit fa3bd2646f
4 changed files with 13 additions and 3 deletions

View File

@@ -90,7 +90,8 @@ namespace Lidgren.Network
double now = NetTime.Now; // need exact number
m_lastHeardFrom = now;
m_lastSendRespondedTo = m_lastPingSendTime;
if (m_lastPingSendTime > m_lastSendRespondedTo)
m_lastSendRespondedTo = m_lastPingSendTime;
double rtt = now - m_lastPingSendTime;
@@ -126,6 +127,7 @@ namespace Lidgren.Network
// timeout
if (now > m_lastSendRespondedTo + m_peerConfiguration.m_connectionTimeout)
{
m_owner.LogDebug(this + " timed out; now is " + now + " last responded to is: " + m_lastSendRespondedTo);
Disconnect("Timed out after " + (now - m_lastSendRespondedTo) + " seconds");
return;
}

View File

@@ -357,7 +357,7 @@ namespace Lidgren.Network
// Reliable delivery methods below
//
// queue ack
// queue ack; regardless if this is a duplicate or not
m_acknowledgesToSend.Enqueue((int)channelSequenceNumber | ((int)mtp << 16));
if (m_nextForceAckTime == double.MaxValue)
m_nextForceAckTime = now + m_peerConfiguration.m_maxAckDelayTime;

View File

@@ -113,6 +113,9 @@ namespace Lidgren.Network
connectionReset = false;
try
{
if (target.Address == IPAddress.Broadcast)
m_socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);
int bytesSent = m_socket.SendTo(data, 0, numBytes, SocketFlags.None, target);
if (numBytes != bytesSent)
LogWarning("Failed to send the full " + numBytes + "; only " + bytesSent + " bytes sent in packet!");
@@ -131,6 +134,11 @@ namespace Lidgren.Network
{
LogError("Failed to send packet: " + ex);
}
finally
{
if (target.Address == IPAddress.Broadcast)
m_socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, false);
}
}
#else

View File

@@ -76,7 +76,7 @@ namespace Lidgren.Network
m_maximumConnections = 16;
m_defaultOutgoingMessageCapacity = 8;
m_pingFrequency = 6.0f;
m_throttleBytesPerSecond = 1024 * 512;
m_throttleBytesPerSecond = 1024 * 256;
m_throttlePeakBytes = 8192;
m_maxAckDelayTime = 0.01f;
m_handshakeAttemptDelay = 1.0f;