예제 #1
0
 /// <summary>
 /// Dispose
 /// </summary>
 public void Dispose()
 {
     if (_channel != null)
     {
         _channel.Dispose();
         _channel = null;
     }
 }
예제 #2
0
        /// <summary>
        /// 关闭频道并从列表里移除
        /// </summary>
        private void RemoveChannel(TcpChannel channel)
        {
            if (channel == null)
            {
                return;
            }

            channel.Dispose();

            // 从频道列表里删除
            lock (_allChannels)
            {
                _allChannels.Remove(channel);
            }

            // 信号减弱
            if (_maxAcceptedSemaphore != null)
            {
                _maxAcceptedSemaphore.Release();
            }
        }