@@ -8,16 +8,16 @@ namespace MLAPI.Internal
88{
99 internal static partial class InternalMessageHandler
1010 {
11- internal static void Send ( uint clientId , byte messageType , string channelName , Stream messageStream , InternalSecuritySendOptions options , bool skipQueue = false )
11+ internal static void Send ( uint clientId , byte messageType , string channelName , Stream messageStream , InternalSecuritySendOptions securityOptions , bool skipQueue = false )
1212 {
1313 if ( NetworkingManager . singleton . isServer && clientId == NetworkingManager . singleton . ServerClientId ) return ;
1414 using ( PooledBitStream stream = PooledBitStream . Get ( ) )
1515 {
1616 using ( PooledBitWriter writer = PooledBitWriter . Get ( stream ) )
1717 {
18- writer . WriteBool ( options . encrypted ) ;
19- writer . WriteBool ( options . authenticated ) ;
20- if ( options . encrypted && netManager . NetworkConfig . EnableEncryption )
18+ writer . WriteBool ( securityOptions . encrypted ) ;
19+ writer . WriteBool ( securityOptions . authenticated ) ;
20+ if ( securityOptions . encrypted && netManager . NetworkConfig . EnableEncryption )
2121 {
2222 writer . WritePadBits ( ) ;
2323 using ( RijndaelManaged rijndael = new RijndaelManaged ( ) )
@@ -38,7 +38,7 @@ internal static void Send(uint clientId, byte messageType, string channelName, S
3838 }
3939 }
4040 }
41- else if ( options . authenticated && netManager . NetworkConfig . EnableEncryption )
41+ else if ( securityOptions . authenticated && netManager . NetworkConfig . EnableEncryption )
4242 {
4343 writer . WritePadBits ( ) ;
4444
@@ -66,8 +66,17 @@ internal static void Send(uint clientId, byte messageType, string channelName, S
6666 }
6767 }
6868
69- internal static void Send ( byte messageType , string channelName , Stream messageStream )
69+ internal static void Send ( byte messageType , string channelName , Stream messageStream , InternalSecuritySendOptions securityOptions )
7070 {
71+ if ( netManager . NetworkConfig . EnableEncryption && ( securityOptions . authenticated || securityOptions . encrypted ) )
72+ {
73+ for ( int i = 0 ; i < netManager . ConnectedClientsList . Count ; i ++ )
74+ {
75+ Send ( netManager . ConnectedClientsList [ i ] . ClientId , messageType , channelName , messageStream , securityOptions ) ;
76+ }
77+ return ;
78+ }
79+
7180 using ( PooledBitStream stream = PooledBitStream . Get ( ) )
7281 {
7382 using ( PooledBitWriter writer = PooledBitWriter . Get ( stream ) )
@@ -87,8 +96,18 @@ internal static void Send(byte messageType, string channelName, Stream messageSt
8796 }
8897 }
8998
90- internal static void Send ( byte messageType , string channelName , uint clientIdToIgnore , Stream messageStream )
99+ internal static void Send ( byte messageType , string channelName , uint clientIdToIgnore , Stream messageStream , InternalSecuritySendOptions securityOptions )
91100 {
101+ if ( netManager . NetworkConfig . EnableEncryption && ( securityOptions . authenticated || securityOptions . encrypted ) )
102+ {
103+ for ( int i = 0 ; i < netManager . ConnectedClientsList . Count ; i ++ )
104+ {
105+ if ( netManager . ConnectedClientsList [ i ] . ClientId == clientIdToIgnore ) continue ;
106+ Send ( netManager . ConnectedClientsList [ i ] . ClientId , messageType , channelName , messageStream , securityOptions ) ;
107+ }
108+ return ;
109+ }
110+
92111 using ( PooledBitStream stream = PooledBitStream . Get ( ) )
93112 {
94113 using ( PooledBitWriter writer = PooledBitWriter . Get ( stream ) )
0 commit comments