mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
refactor: SendToObserver returns void (#1539)
We calculate a bool out of SendToObserver, but it is not clear what it is and we don't use the result at all. So just simplify things.
This commit is contained in:
parent
549c729a07
commit
9c81c9b2eb
@ -217,7 +217,7 @@ internal static void ActivateHostScene()
|
||||
|
||||
// this is like SendToReady - but it doesn't check the ready flag on the connection.
|
||||
// this is used for ObjectDestroy messages.
|
||||
static bool SendToObservers<T>(NetworkIdentity identity, T msg, int channelId = Channels.DefaultReliable) where T : IMessageBase
|
||||
static void SendToObservers<T>(NetworkIdentity identity, T msg, int channelId = Channels.DefaultReliable) where T : IMessageBase
|
||||
{
|
||||
if (LogFilter.Debug) Debug.Log("Server.SendToObservers id:" + typeof(T));
|
||||
|
||||
@ -234,12 +234,11 @@ static bool SendToObservers<T>(NetworkIdentity identity, T msg, int channelId =
|
||||
// -> makes code more complicated, but is HIGHLY worth it to
|
||||
// avoid allocations, allow for multicast, etc.
|
||||
connectionIdsCache.Clear();
|
||||
bool result = true;
|
||||
foreach (KeyValuePair<int, NetworkConnection> kvp in identity.observers)
|
||||
{
|
||||
// use local connection directly because it doesn't send via transport
|
||||
if (kvp.Value is ULocalConnectionToClient)
|
||||
result &= kvp.Value.Send(segment);
|
||||
kvp.Value.Send(segment);
|
||||
// gather all internet connections
|
||||
else
|
||||
connectionIdsCache.Add(kvp.Key);
|
||||
@ -252,11 +251,8 @@ static bool SendToObservers<T>(NetworkIdentity identity, T msg, int channelId =
|
||||
}
|
||||
|
||||
NetworkDiagnostics.OnSend(msg, Channels.DefaultReliable, segment.Count, identity.observers.Count);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Deprecated 03/03/2019
|
||||
|
Loading…
Reference in New Issue
Block a user