Esempio n. 1
0
        public TcpSslSession(Socket socket, ATcpOptions options, PipeScheduler scheduler, MemoryPool <byte> pool, SslFeature sslFeature, FilterPipeline <ITcpSession> filterPipeline)
            : base(socket, options, scheduler, pool, filterPipeline)
        {
            var inputPipeOptions  = StreamPipeOptionsHelper.ReaderOptionsCreator(pool);
            var outputPipeOptions = StreamPipeOptionsHelper.WriterOptionsCreator(pool);
            var sslDuplexPipe     = new SslStreamDuplexPipe(base.Transport, inputPipeOptions, outputPipeOptions, sslFeature.sslStreamFactory);

            this.sslTransport = sslDuplexPipe;
            this.sslOptions   = sslFeature.sslOptions;
        }
Esempio n. 2
0
        public ATcpSession(Socket socket, ATcpOptions options, PipeScheduler scheduler, MemoryPool <byte> pool, FilterPipeline <ITcpSession> filterPipeline)
        {
            this.Id                 = IdGeneratorHelper.GetNextId();
            this.Order              = options.Order;
            this.MemoryPool         = pool;
            this.Scheduler          = scheduler;
            this.MemoryPool         = pool;
            this.Scheduler          = scheduler;
            this.minAllocBufferSize = this.MemoryPool.MaxBufferSize / 2;

            this.filterPipeline = filterPipeline;
            this.socket         = new TcpSocket(socket, scheduler);
            this.LocalAddress   = this.socket.BindAddress;
            this.RemoteAddress  = this.socket.RemoteAddress;

            this.SettingSocket(this.socket, options);
            this.SettingPipeline(options.MaxPipelineReadBufferSize, options.MaxPipelineWriteBufferSize);
        }
Esempio n. 3
0
        private void SettingSocket(TcpSocket socket, ATcpOptions options)
        {
            this.socket.SettingKeepAlive(options.KeepAlive);
            this.socket.SettingLingerState(options.LingerOption);
            this.socket.SettingNoDelay(options.NoDelay);

            if (options.RcvTimeout != null)
            {
                this.socket.SettingRcvTimeout(options.RcvTimeout.Value);
            }
            if (options.SndTimeout != null)
            {
                this.socket.SettingSndTimeout(options.SndTimeout.Value);
            }
            if (options.RcvBufferSize != null)
            {
                this.socket.SettingRcvBufferSize(options.RcvBufferSize.Value);
            }
            if (options.SndBufferSize != null)
            {
                this.socket.SettingSndBufferSize(options.SndBufferSize.Value);
            }
        }
Esempio n. 4
0
 private ATcpSession CreateSslSession(Socket socket, ATcpOptions options, PipeScheduler scheduler, MemoryPool <byte> pool)
 {
     return(new TcpSslSession(socket, options, scheduler, pool, this.sslFeature, this.CreateFilterPipeline()));
 }
Esempio n. 5
0
 public TcpSession(Socket socket, ATcpOptions options, PipeScheduler scheduler, MemoryPool <byte> pool, FilterPipeline <ITcpSession> filterPipeline)
     : base(socket, options, scheduler, pool, filterPipeline)
 {
     this.readerFlushCallback = this.OnFilterReadFlush;
     this.writerFlushCallback = (writer) => { };
 }