1
- using System . IO ;
2
- using System . Security . Cryptography ;
3
- using MLAPI . Data ;
1
+ using MLAPI . Data ;
4
2
using MLAPI . Profiling ;
5
3
using MLAPI . Serialization ;
6
4
@@ -10,7 +8,10 @@ internal static partial class InternalMessageHandler
10
8
{
11
9
internal static void Send ( uint clientId , byte messageType , string channelName , BitStream messageStream , SecuritySendFlags flags , bool skipQueue = false )
12
10
{
11
+ messageStream . ZeroLastByteGarbageBits ( ) ;
12
+
13
13
if ( NetworkingManager . singleton . isServer && clientId == NetworkingManager . singleton . ServerClientId ) return ;
14
+
14
15
using ( BitStream stream = MessageManager . WrapMessage ( messageType , clientId , messageStream , flags ) )
15
16
{
16
17
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
37
38
}
38
39
else
39
40
{
41
+ messageStream . ZeroLastByteGarbageBits ( ) ;
42
+
40
43
using ( BitStream stream = MessageManager . WrapMessage ( messageType , 0 , messageStream , flags ) )
41
44
{
42
45
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
68
71
}
69
72
else
70
73
{
74
+ messageStream . ZeroLastByteGarbageBits ( ) ;
75
+
71
76
using ( BitStream stream = MessageManager . WrapMessage ( messageType , 0 , messageStream , flags ) )
72
77
{
73
78
NetworkProfiler . StartEvent ( TickType . Send , ( uint ) stream . Length , channelName , MLAPIConstants . MESSAGE_NAMES [ messageType ] ) ;
0 commit comments