Exemplo n.º 1
0
        /// <summary>
        /// 初始化(会话池,最大连接数)
        /// </summary>
        public void initialize()
        {
            _semaphore = new Semaphore(_setting.MaxConcurrentNumber, _setting.MaxConcurrentNumber);

            _sessionPool = new SessionPool(_setting.MaxConcurrentNumber);

            for (int i = 0; i < _setting.MaxConcurrentNumber; i++)
            {
                //var _channel = new Channel(createPipeline(), this.Buffer, _container.Get<IFramer>());
                var framer  = _container.Get <IFramer>();
                var channel = new Channel(this.Buffer, framer);

                _sessionPool.Push(channel);
            }

            _session = new Session();

            Console.WriteLine("初始化完毕...");
        }