예제 #1
0
    public void PushEvent(EvtType eType, int value = 0)
    {
        SNetEvent oEvent = new SNetEvent();

        oEvent.eType = eType;
        oEvent.value = value;

        lock (m_oEvtQueue)
        {
            m_oEvtQueue.Enqueue(oEvent);
        }
    }
예제 #2
0
    public void run()
    {
        if (GetState() == SocketState.state_connectok)
        {
            if (m_Pollio != null)
            {
                m_Pollio.asyncwrite();
            }
        }

        if (m_oEvtQueue.Count < 1)
        {
            return;
        }

        lock (m_oEvtQueue)
        {
            SNetEvent events = m_oEvtQueue.Dequeue();
            if (events != null)
            {
                switch (events.eType)
                {
                case EvtType.netevt_connect:
                {
                    OnConnect();
                }
                break;

                case EvtType.netevt_establish:
                {
                    OnAddSession();
                }
                break;

                case EvtType.netevt_fail:
                {
                    OnDelSession();
                }
                break;

                default:
                    break;
                }
            }
        }
    }