internal void ExecuteDisconnect(string reason, bool sendByeMessage)
        {
            m_peer.VerifyNetworkThread();

            //m_peer.LogDebug("Executing disconnect");

            // clear send queues
            for (int i = 0; i < m_sendChannels.Length; i++)
            {
                NetSenderChannelBase channel = m_sendChannels[i];
                if (channel != null)
                {
                    channel.Reset();
                }
            }

            if (sendByeMessage)
            {
                SendDisconnect(reason, true);
            }

            SetStatus(NetConnectionStatus.Disconnected, reason);

            // in case we're still in handshake
            lock (m_peer.m_handshakes)
                m_peer.m_handshakes.Remove(m_remoteEndPoint);

            m_disconnectRequested = false;
            m_connectRequested    = false;
            m_handshakeAttempts   = 0;
        }
        internal void ExecuteDisconnect(string reason, bool sendByeMessage)
        {
            // clear send queues
            for (int i = 0; i < m_sendChannels.Length; i++)
            {
                NetSenderChannelBase channel = m_sendChannels[i];
                if (channel != null)
                {
                    channel.Reset();
                }
            }

            if (sendByeMessage)
            {
                SendDisconnect(reason, true);
            }

            if (m_status == NetConnectionStatus.ReceivedInitiation)
            {
                // nothing much has happened yet; no need to send disconnected status message
                m_status = NetConnectionStatus.Disconnected;
            }
            else
            {
                SetStatus(NetConnectionStatus.Disconnected, reason);
            }

            // in case we're still in handshake
            m_peer._handshakeManager.RemoveHandshake(m_remoteEndPoint);

            m_disconnectRequested = false;
            m_connectRequested    = false;
            m_handshakeAttempts   = 0;
        }
        internal void ExecuteDisconnect(string reason, bool sendByeMessage)
        {
            m_peer.VerifyNetworkThread();

            // m_peer.LogDebug("Executing disconnect");

            // clear send queues
            for (int i = 0; i < m_sendChannels.Length; i++)
            {
                NetSenderChannelBase channel = m_sendChannels[i];
                if (channel != null)
                {
                    channel.Reset();
                }
            }

            if (sendByeMessage)
            {
                SendDisconnect(reason, true);
            }

            SetStatus(NetConnectionStatus.Disconnected, reason);
            m_disconnectRequested = false;
            m_connectRequested    = false;
        }