Beispiel #1
0
        /// <summary>
        /// Close channel.
        /// </summary>
        public void Close()
        {
            lock (_statusSync) {
                if (_status != StreamStatus.Opened && _status != StreamStatus.Error)
                {
                    return;
                }

                _status = StreamStatus.Closing;
            }

            _channel.SendEOF();

            if (_status != StreamStatus.Closing)
            {
                return;
            }

            _channel.Close();

            lock (_statusSync) {
                if (_status == StreamStatus.Closing)
                {
                    _status = StreamStatus.Closed;
                }
            }
        }
Beispiel #2
0
 public void SendEOF()
 {
     lock (_connection) {
         if (!_sentEOF && !_closed)
         {
             _sentEOF = true;
             _channel.SendEOF();
         }
     }
 }