示例#1
0
 public PoolProvider(TCPOptions config)
 {
     this.SendingPool         = new SendingQueuePool(config.SizeOfSendQueue, config.IncreasesOfSendingQueuePool, config.MaxOfSendingQueuePool);
     this.SocketEventArgsPool = new EventArgPool(config.IncreasesOfEventArgPool, config.MaxOfClient <= 0 ? 0 : config.MaxOfClient * 2);
     this.ReceiveBufferPool   = new ReceiveBufferPool(config.BufferSizeOfReceiveBufferPool, config.IncreasesOfReceiveBufferPool, config.MaxOfReceiveBufferPool);
     this.PacketBufferPool    = new PacketBufferPool(config.BufferSizeOfPacketBufferPool, config.IncreasesOfPacketBufferPool, config.MaxOfPacketBufferPool);
 }
示例#2
0
        public void Initialize()
        {
            var TCPOptions = new TCPOptions()
            {
                IPv4Address = "1.1.1.1",
                Port        = 53,
                Timeout     = new TimeSpan(0, 0, 0, 10)
            };

            var TCPOptionsMonitor = Mock.Of <IOptionsMonitor <TCPOptions> >(Options => Options.CurrentValue == TCPOptions);

            Resolver = new TCP(TCPOptionsMonitor);

            RequestMessage = new Message()
            {
                ID = (ushort)new Random().Next(),
                RecursionDesired = true
            };
        }