MessagePacking.HeaderSize renamed to IdSize

This commit is contained in:
vis2k 2022-09-25 12:03:49 +07:00
parent c97bf5a06a
commit 13e6c77bad
3 changed files with 8 additions and 5 deletions

View File

@ -11,8 +11,11 @@ namespace Mirror
// Content (ContentSize bytes)
public static class MessagePacking
{
// message header size
public const int HeaderSize = sizeof(ushort);
[Obsolete("HeaderSize was renamed to IdSize")] // 2022-09-25
public static int HeaderSize => IdSize;
// size of message id header in bytes
public const int IdSize = sizeof(ushort);
// max message content size (without header) calculation for convenience
// -> Transport.GetMaxPacketSize is the raw maximum
@ -22,7 +25,7 @@ public static int MaxContentSize
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => Transport.active.GetMaxPacketSize()
- HeaderSize
- IdSize
- Batcher.HeaderSize;
}

View File

@ -347,7 +347,7 @@ internal static void OnTransportData(ArraySegment<byte> data, int channelId)
unbatcher.GetNextMessage(out NetworkReader reader, out double remoteTimestamp))
{
// enough to read at least header size?
if (reader.Remaining >= MessagePacking.HeaderSize)
if (reader.Remaining >= MessagePacking.IdSize)
{
// make remoteTimeStamp available to the user
connection.remoteTimeStamp = remoteTimestamp;

View File

@ -507,7 +507,7 @@ internal static void OnTransportData(int connectionId, ArraySegment<byte> data,
connection.unbatcher.GetNextMessage(out NetworkReader reader, out double remoteTimestamp))
{
// enough to read at least header size?
if (reader.Remaining >= MessagePacking.HeaderSize)
if (reader.Remaining >= MessagePacking.IdSize)
{
// make remoteTimeStamp available to the user
connection.remoteTimeStamp = remoteTimestamp;