mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
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:
parent
b8a289ba49
commit
be9efea78c
@ -254,7 +254,7 @@ internal bool SendBytes(byte[] bytes, int bytesToSend)
|
|||||||
UnityEditor.NetworkDetailStats.NetworkDirection.Outgoing,
|
UnityEditor.NetworkDetailStats.NetworkDirection.Outgoing,
|
||||||
MsgType.HLAPIMsg, "msg", 1);
|
MsgType.HLAPIMsg, "msg", 1);
|
||||||
#endif
|
#endif
|
||||||
if (bytesToSend >= UInt16.MaxValue)
|
if (bytesToSend > UInt16.MaxValue)
|
||||||
{
|
{
|
||||||
if (LogFilter.logError) { Debug.LogError("ChannelBuffer:SendBytes cannot send packet larger than " + UInt16.MaxValue + " bytes"); }
|
if (LogFilter.logError) { Debug.LogError("ChannelBuffer:SendBytes cannot send packet larger than " + UInt16.MaxValue + " bytes"); }
|
||||||
return false;
|
return false;
|
||||||
|
@ -443,7 +443,7 @@ static public bool SendToReady(GameObject contextObj, short msgType, MessageBase
|
|||||||
|
|
||||||
static public void SendWriterToReady(GameObject contextObj, NetworkWriter writer, int channelId)
|
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!");
|
throw new UnityException("NetworkWriter used buffer is too big!");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user