/// <summary> Processes a response to an RPC assignment request. The assigned id and method name are added to the LocalRpcs dictionary. </summary> internal void ReceiveAssignmentResponse(NetMessage netMessage, NetConnection connection) { if (!connection.IsServer && !connection.IsPeer) { return; } var id = (ushort)netMessage.Parameters[0]; var methodName = (string)netMessage.Parameters[1]; if (RpcInfoCache.Exists(methodName) && !idToName.ContainsKey(id)) { idToName.Add(id, methodName); if (!nameToId.ContainsKey(methodName)) { nameToId.Add(methodName, id); } } else { NetLog.Error("Cannot assign local RPC. ID: " + id + " MethodName: " + methodName); } if (idToName.Count == RpcInfoCache.Count) { Socket.SendRequirementsMet(connection); } }
/// <summary> Returns true if the provided rpcID is associated with a method. </summary> internal bool Exists(ushort rpcId) { return(HasName(rpcId) && RpcInfoCache.Exists(IdToName(rpcId))); }