1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-16 23:26:32 +09:00

Added NetConstants.UnfragmentedMessageHeaderSize internal constant

This commit is contained in:
lidgren
2011-06-08 07:22:57 +00:00
parent 5fd2926cd9
commit 9fc85dfe76
3 changed files with 4 additions and 2 deletions

View File

@@ -40,6 +40,8 @@ namespace Lidgren.Network
internal const int MaxFragmentationGroups = ushort.MaxValue - 1;
internal const int UnfragmentedMessageHeaderSize = 5;
/// <summary>
/// Number of channels which needs a sequence number to work
/// </summary>

View File

@@ -106,7 +106,7 @@ namespace Lidgren.Network
internal int GetEncodedSize()
{
int retval = 5; // regular headers
int retval = NetConstants.UnfragmentedMessageHeaderSize; // regular headers
if (m_fragmentGroup != 0)
retval += NetFragmentationHelper.GetFragmentationHeaderSize(m_fragmentGroup, m_fragmentGroupTotalBits / 8, m_fragmentChunkByteSize, m_fragmentChunkNumber);
retval += this.LengthBytes;

View File

@@ -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");
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)
{
Interlocked.Increment(ref msg.m_recyclingCount);