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(); //} }
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(); } } }