NetworkConnection.ValidatePacketSize: syntax

This commit is contained in:
vis2k 2021-06-18 16:41:40 +08:00
parent d818b2d4aa
commit 227efb6c7a

View File

@ -133,9 +133,10 @@ public void Send<T>(T msg, int channelId = Channels.Reliable)
// => it's important to log errors, so the user knows what went wrong.
protected static bool ValidatePacketSize(ArraySegment<byte> segment, int channelId)
{
if (segment.Count > Transport.activeTransport.GetMaxPacketSize(channelId))
int max = Transport.activeTransport.GetMaxPacketSize(channelId);
if (segment.Count > max)
{
Debug.LogError($"NetworkConnection.ValidatePacketSize: cannot send packet larger than {Transport.activeTransport.GetMaxPacketSize(channelId)} bytes, was {segment.Count} bytes");
Debug.LogError($"NetworkConnection.ValidatePacketSize: cannot send packet larger than {max} bytes, was {segment.Count} bytes");
return false;
}