@@ -670,10 +670,7 @@ internal void PassthroughSend(int targetId, int sourceId, ushort messageType, in
670
670
if ( isHost && targetId == - 1 )
671
671
{
672
672
//Host trying to send data to it's own client
673
- if ( networkId == null )
674
- MessageManager . InvokeMessageHandlers ( MessageManager . reverseMessageTypes [ messageType ] , data , sourceId ) ;
675
- else
676
- MessageManager . InvokeTargetedMessageHandler ( MessageManager . reverseMessageTypes [ messageType ] , data , sourceId , networkId . Value ) ;
673
+ Debug . LogWarning ( "MLAPI: Send method got message aimed at server from the server?" ) ;
677
674
return ;
678
675
}
679
676
@@ -701,13 +698,10 @@ internal void PassthroughSend(int targetId, int sourceId, ushort messageType, in
701
698
702
699
internal void Send ( int clientId , string messageType , string channelName , byte [ ] data , uint ? networkId = null )
703
700
{
704
- if ( isHost && clientId == - 1 )
701
+ if ( clientId == - 1 && isHost )
705
702
{
706
- //Host trying to send data to it's own client
707
- if ( networkId == null )
708
- MessageManager . InvokeMessageHandlers ( messageType , data , clientId ) ;
709
- else
710
- MessageManager . InvokeTargetedMessageHandler ( messageType , data , clientId , networkId . Value ) ;
703
+ //Don't invoke the message on our own machine. Instant stack overflow.
704
+ Debug . LogWarning ( "MLAPI: Cannot send message to own client" ) ;
711
705
return ;
712
706
}
713
707
else if ( clientId == - 1 )
@@ -775,10 +769,7 @@ internal void Send(int[] clientIds, string messageType, string channelName, byte
775
769
int clientId = clientIds [ i ] ;
776
770
if ( isHost && clientId == - 1 )
777
771
{
778
- if ( networkId == null )
779
- MessageManager . InvokeMessageHandlers ( messageType , data , clientId ) ;
780
- else
781
- MessageManager . InvokeTargetedMessageHandler ( messageType , data , clientId , networkId . Value ) ;
772
+ //Don't invoke the message on our own machine. Instant stack overflow.
782
773
continue ;
783
774
}
784
775
else if ( clientId == - 1 )
@@ -815,12 +806,9 @@ internal void Send(List<int> clientIds, string messageType, string channelName,
815
806
for ( int i = 0 ; i < clientIds . Count ; i ++ )
816
807
{
817
808
int clientId = clientIds [ i ] ;
818
- if ( isHost && clientId == - 1 )
809
+ if ( clientId == - 1 && isHost )
819
810
{
820
- if ( networkId == null )
821
- MessageManager . InvokeMessageHandlers ( messageType , data , clientId ) ;
822
- else
823
- MessageManager . InvokeTargetedMessageHandler ( messageType , data , clientId , networkId . Value ) ;
811
+ //Don't invoke the message on our own machine. Instant stack overflow.
824
812
continue ;
825
813
}
826
814
else if ( clientId == - 1 )
@@ -859,10 +847,7 @@ internal void Send(string messageType, string channelName, byte[] data, uint? ne
859
847
int clientId = pair . Key ;
860
848
if ( isHost && pair . Key == - 1 )
861
849
{
862
- if ( networkId == null )
863
- MessageManager . InvokeMessageHandlers ( messageType , data , clientId ) ;
864
- else
865
- MessageManager . InvokeTargetedMessageHandler ( messageType , data , clientId , networkId . Value ) ;
850
+ //Don't invoke the message on our own machine. Instant stack overflow.
866
851
continue ;
867
852
}
868
853
else if ( clientId == - 1 )
@@ -876,7 +861,7 @@ internal void Send(string messageType, string channelName, byte[] data, uint? ne
876
861
}
877
862
}
878
863
879
- internal void Send ( string messageType , string channelName , byte [ ] data , int clientIdToIgnore , uint ? networkId = null , bool ignoreHost = false )
864
+ internal void Send ( string messageType , string channelName , byte [ ] data , int clientIdToIgnore , uint ? networkId = null )
880
865
{
881
866
//2 bytes for messageType, 2 bytes for buffer length and one byte for target bool
882
867
int sizeOfStream = 5 ;
@@ -902,12 +887,9 @@ internal void Send(string messageType, string channelName, byte[] data, int clie
902
887
if ( pair . Key == clientIdToIgnore )
903
888
continue ;
904
889
int clientId = pair . Key ;
905
- if ( isHost && pair . Key == - 1 && ! ignoreHost )
890
+ if ( isHost && pair . Key == - 1 )
906
891
{
907
- if ( networkId == null )
908
- MessageManager . InvokeMessageHandlers ( messageType , data , clientId ) ;
909
- else
910
- MessageManager . InvokeTargetedMessageHandler ( messageType , data , clientId , networkId . Value ) ;
892
+ //Don't invoke the message on our own machine. Instant stack overflow.
911
893
continue ;
912
894
}
913
895
else if ( clientId == - 1 )
0 commit comments