示例#1
0
        private void Init(Socket socket, int opaque, long sessionId, BufferPool bufferPool, SessionErrorHandle errorCallback, ReadCompleteHandle readCallback, UserToken userToken)
        {
            m_socket    = socket;
            m_opaque    = opaque;
            m_sessionId = sessionId;

            m_inboundPacketManager  = new InboundPacketManager();
            m_outboundPacketManager = new OutboundPacketManager();

            m_inboundPacketManager.Init(opaque, sessionId, bufferPool, readCallback, errorCallback);
            m_outboundPacketManager.Init(bufferPool);
            m_writeCache = new byte[MaxPacketSize + PacketHeaderSize];

            m_onSessionError = errorCallback;

            m_writeEvent.Completed += IO_Complete;
            m_writeEvent.UserToken  = userToken;

            m_readEvent.Completed += IO_Complete;
            m_readEvent.UserToken  = userToken;
        }