ChannelBuffer, NetworkServer: consistent packet max size check with > UInt16.MaxValue (=64kb) instead of short.MaxValue which would limit packet size to 32kb; also uses consistent '<' check now instead of '<=' sometimes

This commit is contained in:
vis2k 2018-06-12 14:40:34 +02:00
parent b8a289ba49
commit be9efea78c
2 changed files with 2 additions and 2 deletions

View File

@ -254,7 +254,7 @@ internal bool SendBytes(byte[] bytes, int bytesToSend)
UnityEditor.NetworkDetailStats.NetworkDirection.Outgoing,
MsgType.HLAPIMsg, "msg", 1);
#endif
if (bytesToSend >= UInt16.MaxValue)
if (bytesToSend > UInt16.MaxValue)
{
if (LogFilter.logError) { Debug.LogError("ChannelBuffer:SendBytes cannot send packet larger than " + UInt16.MaxValue + " bytes"); }
return false;

View File

@ -443,7 +443,7 @@ static public bool SendToReady(GameObject contextObj, short msgType, MessageBase
static public void SendWriterToReady(GameObject contextObj, NetworkWriter writer, int channelId)
{
if (writer.AsArraySegment().Count > short.MaxValue)
if (writer.Position > UInt16.MaxValue)
{
throw new UnityException("NetworkWriter used buffer is too big!");
}