You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-16 23:26:32 +09:00
Fix for messages near MTU size could cause exception
This commit is contained in:
@@ -44,10 +44,9 @@ namespace Lidgren.Network
|
|||||||
|
|
||||||
if (msg.m_isSent)
|
if (msg.m_isSent)
|
||||||
throw new NetException("This message has already been sent! Use NetPeer.SendMessage() to send to multiple recipients efficiently");
|
throw new NetException("This message has already been sent! Use NetPeer.SendMessage() to send to multiple recipients efficiently");
|
||||||
|
|
||||||
msg.m_isSent = true;
|
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)
|
if (len <= recipient.m_currentMTU)
|
||||||
{
|
{
|
||||||
Interlocked.Increment(ref msg.m_recyclingCount);
|
Interlocked.Increment(ref msg.m_recyclingCount);
|
||||||
|
|||||||
Reference in New Issue
Block a user