Esempio n. 1
0
		public static List<FSAgentCallbac> Get(ClientInfo clientInfo)
		{
			if (IsConnectionLost)
			{
				Thread.Sleep(TimeSpan.FromSeconds(1));
				var result = new List<FSAgentCallbac>();
				var fsAgentCallbac = new FSAgentCallbac()
				{
					IsConnectionLost = IsConnectionLost
				};
				result.Add(fsAgentCallbac);
				return result;
			}

			lock (FSAgentCallbacCashes)
			{
				var result = new List<FSAgentCallbac>();
				var safeCopy = FSAgentCallbacCashes.ToList();
				foreach (var callbackResultSaver in safeCopy)
				{
					if (callbackResultSaver.Index > clientInfo.CallbackIndex)
					{
						result.Add(callbackResultSaver.FSAgentCallbac);
					}
				}
				if (safeCopy.Count > 0)
				{
					clientInfo.CallbackIndex = safeCopy.Max(x => x.Index);
				}
				return result;
			}
		}
Esempio n. 2
0
        public static void Add(Guid uid)
        {
            if (ClientInfos.Any(x => x.UID == uid))
                return;

            var clientInfo = new ClientInfo();
            clientInfo.UID = uid;
            ClientInfos.Add(clientInfo);
        }