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

UseMessageCoalescing fixed :-)

This commit is contained in:
lidgren
2010-06-09 11:48:35 +00:00
parent 10ae62c4cd
commit ce57b96cf5

View File

@@ -205,23 +205,26 @@ namespace Lidgren.Network
int msgPayloadLength = msg.LengthBytes;
msg.m_lastSentTime = now;
if (!useCoalescing || (ptr > 0 && (ptr + NetPeer.kMaxPacketHeaderSize + msgPayloadLength) > mtu))
if (ptr > 0)
{
// send packet and start new packet
bool connectionReset;
m_owner.SendPacket(ptr, m_remoteEndpoint, numIncludedMessages, out connectionReset);
if (connectionReset)
if (!useCoalescing || ((ptr + NetPeer.kMaxPacketHeaderSize + msgPayloadLength) > mtu))
{
// ouch! can't sent any more; lets disconnect
Disconnect(NetConstants.ConnResetMessage);
ptr = 0;
// send packet and start new packet
bool connectionReset;
m_owner.SendPacket(ptr, m_remoteEndpoint, numIncludedMessages, out connectionReset);
if (connectionReset)
{
// ouch! can't sent any more; lets disconnect
Disconnect(NetConstants.ConnResetMessage);
ptr = 0;
numIncludedMessages = 0;
break;
}
m_statistics.PacketSent(ptr, numIncludedMessages);
numIncludedMessages = 0;
break;
m_throttleDebt += ptr;
ptr = 0;
}
m_statistics.PacketSent(ptr, numIncludedMessages);
numIncludedMessages = 0;
m_throttleDebt += ptr;
ptr = 0;
}
//