예제 #1
0
        internal static void HandleServerRPCResponse(ulong clientId, Stream stream)
        {
            using (PooledBitReader reader = PooledBitReader.Get(stream))
            {
                ulong responseId = reader.ReadUInt64Packed();

                if (ResponseMessageManager.ContainsKey(responseId))
                {
                    RpcResponseBase responseBase = ResponseMessageManager.GetByKey(responseId);

                    ResponseMessageManager.Remove(responseId);

                    responseBase.IsDone       = true;
                    responseBase.Result       = reader.ReadObjectPacked(responseBase.Type);
                    responseBase.IsSuccessful = true;
                }
                else
                {
                    if (LogHelper.CurrentLogLevel <= LogLevel.Normal)
                    {
                        LogHelper.LogWarning("ServerRPCResponse message recieved for a non existant responseId: " + responseId + ". This response is lost.");
                    }
                }
            }
        }
        internal static void CheckTimeouts()
        {
            while (responseAdded.Count > 0 && Time.unscaledTime - responseAdded[responseAdded.Keys[0]] > pendingResponses[responseAdded.Keys[0]].Timeout)
            {
                ulong key = responseAdded.Keys[0];

                RpcResponseBase response = pendingResponses[key];
                response.IsDone       = true;
                response.IsSuccessful = false;

                Remove(key);
            }
        }
예제 #3
0
        internal static void HandleServerRPCResponse(ulong clientId, Stream stream)
        {
            using (PooledBitReader reader = PooledBitReader.Get(stream))
            {
                ulong responseId = reader.ReadUInt64Packed();

                if (ResponseMessageManager.ContainsKey(responseId))
                {
                    RpcResponseBase responseBase = ResponseMessageManager.GetByKey(responseId);

                    ResponseMessageManager.Remove(responseId);

                    responseBase.IsDone       = true;
                    responseBase.Result       = reader.ReadObjectPacked(responseBase.Type);
                    responseBase.IsSuccessful = true;
                }
            }
        }
 internal static void Add(ulong key, RpcResponseBase value)
 {
     pendingResponses.Add(key, value);
     responseAdded.Add(key, Time.unscaledTime);
 }