1- using System . IO ;
2- using System . Security . Cryptography ;
3- using MLAPI . Data ;
1+ using MLAPI . Data ;
42using MLAPI . Profiling ;
53using MLAPI . Serialization ;
64
@@ -10,7 +8,10 @@ internal static partial class InternalMessageHandler
108 {
119 internal static void Send ( uint clientId , byte messageType , string channelName , BitStream messageStream , SecuritySendFlags flags , bool skipQueue = false )
1210 {
11+ messageStream . ZeroLastByteGarbageBits ( ) ;
12+
1313 if ( NetworkingManager . singleton . isServer && clientId == NetworkingManager . singleton . ServerClientId ) return ;
14+
1415 using ( BitStream stream = MessageManager . WrapMessage ( messageType , clientId , messageStream , flags ) )
1516 {
1617 NetworkProfiler . StartEvent ( TickType . Send , ( uint ) stream . Length , channelName , MLAPIConstants . MESSAGE_NAMES [ messageType ] ) ;
@@ -37,6 +38,8 @@ internal static void Send(byte messageType, string channelName, BitStream messag
3738 }
3839 else
3940 {
41+ messageStream . ZeroLastByteGarbageBits ( ) ;
42+
4043 using ( BitStream stream = MessageManager . WrapMessage ( messageType , 0 , messageStream , flags ) )
4144 {
4245 NetworkProfiler . StartEvent ( TickType . Send , ( uint ) stream . Length , channelName , MLAPIConstants . MESSAGE_NAMES [ messageType ] ) ;
@@ -68,6 +71,8 @@ internal static void Send(byte messageType, string channelName, uint clientIdToI
6871 }
6972 else
7073 {
74+ messageStream . ZeroLastByteGarbageBits ( ) ;
75+
7176 using ( BitStream stream = MessageManager . WrapMessage ( messageType , 0 , messageStream , flags ) )
7277 {
7378 NetworkProfiler . StartEvent ( TickType . Send , ( uint ) stream . Length , channelName , MLAPIConstants . MESSAGE_NAMES [ messageType ] ) ;
0 commit comments