/// <summary>
        ///     Cleanup everything so that the channel can be resused.
        /// </summary>
        public void Cleanup()
        {
            _encoder.Clear();
            _decoder.Clear();
            _currentOutboundMessage = null;
            _socket = null;

            if (Data != null)
            {
                Data.Clear();
            }

            RemoteEndpoint = EmptyEndpoint.Instance;

            object msg;

            while (_outboundMessages.TryDequeue(out msg))
            {
            }
        }
示例#2
0
 /// <summary>
 ///     Cleanup everything so that the channel can be reused.
 /// </summary>
 public void Cleanup()
 {
     _encoder.Clear();
     _decoder.Clear();
     _socket        = null;
     RemoteEndpoint = EmptyEndpoint.Instance;
     IsConnected    = false;
     if (_sendLock.CurrentCount == 0)
     {
         _sendLock.Release();
     }
     if (_closeEvent.CurrentCount == 1)
     {
         _closeEvent.Wait();
     }
     if (Data != null)
     {
         Data.Clear();
     }
 }
        /// <summary>
        ///     Cleanup everything so that the channel can be resused.
        /// </summary>
        public void Cleanup()
        {
            _encoder.Clear();
            _decoder.Clear();
            _currentOutboundMessage = null;
            _remoteEndPoint         = EmptyEndpoint.Instance;
            _connected = false;
            if (_closeEvent.CurrentCount == 1)
            {
                _closeEvent.Wait();
            }

            if (Data != null)
            {
                Data.Clear();
            }

            object msg;

            while (_outboundMessages.TryDequeue(out msg))
            {
            }
        }