mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkBehaviour.GetInvokerForHash simplified
This commit is contained in:
parent
c9f68f4b73
commit
c52e36af57
@ -269,29 +269,20 @@ internal static bool GetInvokerForHashSyncEvent(int cmdHash, out CmdDelegate inv
|
||||
static bool GetInvokerForHash(int cmdHash, UNetInvokeType invokeType, out CmdDelegate invokeFunction)
|
||||
{
|
||||
Invoker invoker;
|
||||
if (!s_CmdHandlerDelegates.TryGetValue(cmdHash, out invoker))
|
||||
if (s_CmdHandlerDelegates.TryGetValue(cmdHash, out invoker) &&
|
||||
invoker != null &&
|
||||
invoker.invokeType == invokeType)
|
||||
{
|
||||
if (LogFilter.Debug) { Debug.Log("GetInvokerForHash hash:" + cmdHash + " not found"); }
|
||||
invokeFunction = null;
|
||||
return false;
|
||||
invokeFunction = invoker.invokeFunction;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (invoker == null)
|
||||
{
|
||||
if (LogFilter.Debug) { Debug.Log("GetInvokerForHash hash:" + cmdHash + " invoker null"); }
|
||||
invokeFunction = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (invoker.invokeType != invokeType)
|
||||
{
|
||||
Debug.LogError("GetInvokerForHash hash:" + cmdHash + " mismatched invokeType");
|
||||
invokeFunction = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
invokeFunction = invoker.invokeFunction;
|
||||
return true;
|
||||
// debug message if not found, or null, or mismatched type
|
||||
// (no need to throw an error, an attacker might just be trying to
|
||||
// call an cmd with an rpc's hash)
|
||||
if (LogFilter.Debug) { Debug.Log("GetInvokerForHash hash:" + cmdHash + " not found"); }
|
||||
invokeFunction = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
internal bool InvokeCommandDelegate(int cmdHash, NetworkReader reader)
|
||||
|
Loading…
Reference in New Issue
Block a user