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

Fix for messages near MTU size could cause exception

This commit is contained in:
lidgren
2011-06-08 07:18:58 +00:00
parent c940449865
commit 5fd2926cd9

View File

@@ -44,10 +44,9 @@ namespace Lidgren.Network
if (msg.m_isSent)
throw new NetException("This message has already been sent! Use NetPeer.SendMessage() to send to multiple recipients efficiently");
msg.m_isSent = true;
int len = msg.LengthBytes;
int len = 5 + msg.LengthBytes; // headers + length, faster than calling msg.GetEncodedSize
if (len <= recipient.m_currentMTU)
{
Interlocked.Increment(ref msg.m_recyclingCount);