Ejemplo n.º 1
0
 /// <summary>
 /// Called when the socket has been closed by peer
 /// </summary>
 private void OnXSocketClosed()
 {
     try {
         _channel.Close();
     }
     catch (Exception e) {
         System.Diagnostics.Debug.WriteLine(e.Message);
         System.Diagnostics.Debug.WriteLine(e.StackTrace);
     }
 }
Ejemplo n.º 2
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;
                }
            }
        }
Ejemplo n.º 3
0
 public void Close()
 {
     lock (_sync) {
         if (!_closed)
         {
             _closed = true;
             _channel.Close();
         }
     }
 }