public Session(Server server, Socket socket, SocketAsyncEventArgs recvSAEA, SocketAsyncEventArgs sendSAEA) { Server = server; m_Socket = socket; m_RecvSAEA = recvSAEA; m_SendSAEA = sendSAEA; m_RecvSAEA.UserToken = this; m_SendSAEA.UserToken = this; StartTime = DateTime.Now; LastActiveTime = StartTime; }
public void Stop() { if (m_ListenSocket == null) return; lock (this) { if (m_ListenSocket == null) return; try { m_ListenSocket.Close(); } finally { m_ListenSocket = null; } Server = null; } }
public void Dispose() { Server = null; }
public Listener(ServerConfig.ListenerConfig listenerConfig, Server server) { m_Config = listenerConfig; Server = server; }
public ExampleSession(Server server, Socket socket, SocketAsyncEventArgs recvSAEA, SocketAsyncEventArgs sendSAEA) : base(server, socket, recvSAEA, sendSAEA) { }
public void Stop() { Server = null; }
public Connector(Server server) { Server = server; }
public void Disconnect(CloseReason reason = CloseReason.Unknown) { //// 받거나 보내고 있는 중이라면 Closing으로 바꾸고 넘어가자 //if (flagReceiving.IsTrue() || flagSending.IsTrue()) //{ // flagClosing.ForceTrue(); // m_ClosingReason = reason; // return; //} if (flagClosing.SetTrue() == true) { if (reason == CloseReason.Unknown) reason = m_ClosingReason; else m_ClosingReason = reason; m_SendingList.Clear(); ArraySegment<byte> arraySeg; while (m_SendQueue.TryDequeue(out arraySeg)) { Server.m_PooledBufferManager.Return(arraySeg.Array); } if (m_Socket != null) { m_Socket.CloseEx(); m_Socket = null; } // 얘들은 윗단에서 이벤트 받은 서버쪽에서 풀에 다시 넣는다 //m_RecvSAEA = null; //m_SendSAEA = null; Server = null; OnDisconnected(reason); flagClosed.ForceTrue(); } }