Exemple #1
0
        public void Dispose()
        {
            if (m_timer != null)
            {
                lock (m_timer)
                {
                    Packet packet;
                    while (m_receiveQueue.Count > 0)
                    {
                        if (m_receiveQueue.TryDequeue(out packet))
                        {
                            packet.Delete();
                        }
                    }
                    m_timer.Dispose();
                    m_timer       = null;
                    m_timerAction = null;
                }
            }

            if (!m_peer.IsNull)
            {
                m_peer.Shutdown(300);
                m_peer.Delete();
            }
            GC.SuppressFinalize(this);
        }