mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
MessagePacking.HeaderSize renamed to IdSize
This commit is contained in:
parent
c97bf5a06a
commit
13e6c77bad
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user