Exemplo n.º 1
0
        internal bool Init(ILPNetMessageHandler netMessageHandler)
        {
            bool bResult = false;

            Reactor = new LPReactor();
            if (LOG_ERROR(Reactor != null))
            {
                goto Exit0;
            }

            bResult = Reactor.Init();
            if (LOG_ERROR(bResult))
            {
                goto Exit0;
            }

            EventMgr = new LPNetEventMgr();
            if (LOG_ERROR(EventMgr != null))
            {
                goto Exit0;
            }

            bResult = EventMgr.Init(netMessageHandler, LP.NetEventListCount);
            if (LOG_ERROR(bResult))
            {
                goto Exit0;
            }

            m_ValidSockerList = new LPBaseList();
            if (LOG_ERROR(m_ValidSockerList != null))
            {
                goto Exit0;
            }

            m_DelayCloseList = new LPBaseList();
            if (LOG_ERROR(m_DelayCloseList != null))
            {
                goto Exit0;
            }

            m_DelayReleaseList = new LPBaseList();
            if (LOG_ERROR(m_DelayReleaseList != null))
            {
                goto Exit0;
            }

            m_CheckDelayRun    = true;
            m_CheckDelayThread = new Thread(_CheckDelayThreadProc);
            m_CheckDelayThread.Start();

            m_PostSendRun    = true;
            m_PostSendThread = new Thread(_PostSendThreadProc);
            m_PostSendThread.Start();

            return(true);

Exit0:
            return(false);
        }
Exemplo n.º 2
0
        internal bool UnInit()
        {
            if (m_CheckDelayRun)
            {
                m_CheckDelayRun = false;
                m_CheckDelayThread.Join();
            }
            m_CheckDelayThread = null;

            if (m_PostSendRun)
            {
                m_PostSendRun = false;
                m_PostSendThread.Join();
            }
            m_PostSendThread = null;

            if (Reactor != null)
            {
                Reactor.UnInit();
                Reactor = null;
            }

            if (EventMgr != null)
            {
                EventMgr.UnInit();
                EventMgr = null;
            }

            if (EventMgr != null)
            {
                EventMgr.UnInit();
                EventMgr = null;
            }

            return(true);
        }