Ejemplo n.º 1
0
        private void Close(string msg)
        {
            bool connected = false;

            if (m_client != null)
            {
                connected = true;
                m_client.Close();
                m_client = null;
                m_kcp    = null;

                if (s_updateList.Contains(this))
                {
                    s_updateList.Remove(this);
                }
            }

            if (connected)
            {
                m_msgProtocol.Reset();
                DispatchEvent(SocketEvent.DISCONNECT, msg);
            }
        }
Ejemplo n.º 2
0
        private void Close(string msg)
        {
            if (m_stream != null)
            {
                m_stream.Close();
                m_stream = null;
            }

            if (m_client != null)
            {
                m_client.Close();
                m_client = null;
            }

            bool connected = this.connected;

            connecting = this.connected = false;

            if (connected)
            {
                m_msgProtocol.Reset();
                DispatchEvent(SocketEvent.DISCONNECT, msg);
            }
        }