protected virtual void Dispose(bool disposing) { if (m_disposed) return; if (disposing) { if (null != m_desc) { m_desc.Dispose(); m_desc = null; } m_session = null; } m_disposed = true; }
public SessionBase CreateSession(Socket socket) { SocketAsyncEventArgs recvSAEA; if (!m_managerSAEA.TryPopRecvSAEA(out recvSAEA)) { Task.Run(() => { socket.CloseEx(); }); // 로그 return(null); } SocketAsyncEventArgs sendSAEA; if (!m_managerSAEA.TryPopSendSAEA(out sendSAEA)) { m_managerSAEA.PushRecvSAEA(recvSAEA); Task.Run(() => { socket.CloseEx(); }); // 로그 return(null); } ServerSession session = new ServerSession(socket, recvSAEA, sendSAEA, m_managerSAEA.m_pooledBufferManager); if (null == session) { recvSAEA.UserToken = null; sendSAEA.UserToken = null; m_managerSAEA.PushRecvSAEA(recvSAEA); m_managerSAEA.PushSendSAEA(sendSAEA); Task.Run(() => { socket.CloseEx(); }); return(null); } long managedNumber = m_keyGenerator.Alloc(); session.SetNumber(managedNumber, Environment.TickCount); if (null != m_fnAddSession) { m_fnAddSession(session); } //if (false == m_managerSession.TryAdd(session)) // return null; return(session); }
public void RequestRegistServer(eServerType eFromServerType) { ServerSession ss = m_session as ServerSession; descOtherServer desc = new descOtherServer(); desc.m_eServerType = m_eToServerType; ss.m_descServer = desc; using (PT_Server_RegisterAtCenter_RQ fmp = new PT_Server_RegisterAtCenter_RQ()) { fmp.m_eServerType = eFromServerType; fmp.m_nSequence = m_nSequence; fmp.m_strIP = m_fromConfig.m_strPublicIP; fmp.m_nPort = m_fromConfig.m_nPort; SendPacket(fmp); } }