Пример #1
0
        /// <summary>
        /// 为客户端id添加Tcp索引列表
        /// </summary>
        /// <param name="clientId"></param>
        /// <param name="key"></param>
        public void AddNewClient2Dic(PackageResponse tcpPack)
        {
            TcpResponseBase pack = (TcpResponseBase)tcpPack;

            int    clientId = pack.ClientId;
            string key      = pack.tcpId;

            string clientKey = null;
            bool   isInclude = false;

            lock (clientDic)
            {
                if (clientDic.TryGetValue(clientId, out clientKey))
                {
                    if (clientKey.Equals(key))
                    {
                        return;
                    }
                    isInclude = true;
                }
            }


            if (isInclude)
            {
                lock (tmpClientDic)
                {
                    if (!(tmpClientDic[key].timeTick < tmpClientDic[clientKey].timeTick))
                    {
                        return;
                    }
                    else
                    {
                        tmpClientDic[clientKey].DestoryTcpServer();
                    }
                }
            }


            lock (clientDic)
            {
                clientDic.Remove(clientId);
                clientDic.Add(clientId, clientKey);
            }
        }
Пример #2
0
 public void AddMessage(PackageResponse pack)
 {
     protocolMgr.AddRespPackage2Arr(pack);
 }
Пример #3
0
 public void AddRespPackage2Arr(PackageResponse respPack)
 {
     lock (respList)
         respList.Add(respPack);
 }
Пример #4
0
 private static void SentMsg(int protocol, PackageResponse pack)
 {
     Common.EventMgr.EventSystemMgr.SentEvent("ProtocolMgr====" + protocol, pack);
 }