Ejemplo n.º 1
0
        protected void RemoveFromOpenedSockList(NetSock sock)
        {
            if (CoresConfig.SocketLogSettings.DisableSocketLog == false)
            {
                try
                {
                    LogDefSocket log = sock.GenerateLogDef(LogDefSocketAction.Disconnected);
                    log.NetworkSystem = this.ToString();
                    LocalLogRouter.PostSocketLog(log, LogTag.SocketDisconnected);
                }
                catch (Exception ex)
                {
                    ex._Debug();
                }
            }

            lock (LockObj)
                OpenedSockList.Remove(sock);

            //if (OpenedSockList.Count == 0)
            //{
            //    Dbg.Where();
            //    Dbg.GcCollect();
            //}
        }
Ejemplo n.º 2
0
        protected void AddToOpenedSockList(NetSock sock, string logTag)
        {
            lock (LockObj)
            {
                sock.Id = (++IdSeed);
                OpenedSockList.Add(sock);
            }

            sock.AddOnCancelAction(() =>
            {
                this.RemoveFromOpenedSockList(sock);
            });

            if (CoresConfig.SocketLogSettings.DisableSocketLog == false)
            {
                try
                {
                    LogDefSocket log = sock.GenerateLogDef(LogDefSocketAction.Connected);
                    log.NetworkSystem = this.ToString();
                    LocalLogRouter.PostSocketLog(log, logTag);
                }
                catch (Exception ex)
                {
                    ex._Debug();
                }
            }
        }