You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-19 00:26:30 +09:00
Added NetConstants.UnfragmentedMessageHeaderSize internal constant
This commit is contained in:
@@ -40,6 +40,8 @@ namespace Lidgren.Network
|
|||||||
|
|
||||||
internal const int MaxFragmentationGroups = ushort.MaxValue - 1;
|
internal const int MaxFragmentationGroups = ushort.MaxValue - 1;
|
||||||
|
|
||||||
|
internal const int UnfragmentedMessageHeaderSize = 5;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of channels which needs a sequence number to work
|
/// Number of channels which needs a sequence number to work
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ namespace Lidgren.Network
|
|||||||
|
|
||||||
internal int GetEncodedSize()
|
internal int GetEncodedSize()
|
||||||
{
|
{
|
||||||
int retval = 5; // regular headers
|
int retval = NetConstants.UnfragmentedMessageHeaderSize; // regular headers
|
||||||
if (m_fragmentGroup != 0)
|
if (m_fragmentGroup != 0)
|
||||||
retval += NetFragmentationHelper.GetFragmentationHeaderSize(m_fragmentGroup, m_fragmentGroupTotalBits / 8, m_fragmentChunkByteSize, m_fragmentChunkNumber);
|
retval += NetFragmentationHelper.GetFragmentationHeaderSize(m_fragmentGroup, m_fragmentGroupTotalBits / 8, m_fragmentChunkByteSize, m_fragmentChunkNumber);
|
||||||
retval += this.LengthBytes;
|
retval += this.LengthBytes;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace Lidgren.Network
|
|||||||
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 = 5 + msg.LengthBytes; // headers + length, faster than calling msg.GetEncodedSize
|
int len = NetConstants.UnfragmentedMessageHeaderSize + 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