예제 #1
0
        public TcpClientChannel(SchedulerAllocator allocator, MemoryPool <byte> memoryPool, TcpClientOptions options,
                                Action <IFilterPipeline <ITcpSession> > handler, SslFeature sslFeature)

            : base(handler, sslFeature, options)
        {
            this.memoryPool         = memoryPool;
            this.schedulerAllocator = allocator;
        }
예제 #2
0
        public void ConfigurationSsl(SslOptions sslOptions, Func <Stream, SslStream> sslStreamFactory)
        {
            if (sslOptions == null)
            {
                throw new ArgumentNullException(nameof(sslOptions));
            }
            if (sslStreamFactory == null)
            {
                throw new ArgumentNullException(nameof(sslStreamFactory));
            }

            this.sslFeature = new SslFeature(sslOptions, sslStreamFactory);
        }
예제 #3
0
        public ATcpChannel(Action <IFilterPipeline <ITcpSession> > handler, SslFeature sslFeature, TOptions options)
        {
            base.ConfigurationSelfOptions(options);
            base.ConfigurationSelfFilter(handler);
            this.sslFeature = sslFeature;

            if (sslFeature == null)
            {
                this.createSession = CreateSession;
            }
            else
            {
                this.createSession = CreateSslSession;
            }
        }
예제 #4
0
 protected override Task <ITcpServerChannel> ChannelFactoryAsync(TcpServerOptions options, Action <IFilterPipeline <ITcpSession> > handler, SslFeature sslFeature)
 {
     return(Task.FromResult((ITcpServerChannel) new TcpServerChannel(options, handler, sslFeature)));
 }
예제 #5
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;
        }
예제 #6
0
 protected override Task <ITcpClientChannel> ChannelFactoryAsync(TcpClientOptions options, Action <IFilterPipeline <ITcpSession> > handler, SslFeature sslFeature)
 {
     return(Task.FromResult((ITcpClientChannel) new TcpClientChannel(this.schedulerAllocator, this.memoryPool, options, handler, sslFeature)));
 }
예제 #7
0
 public TcpServerChannel(TcpServerOptions options, Action <IFilterPipeline <ITcpSession> > handler, SslFeature sslFeature)
     : base(handler, sslFeature, options)
 {
     this.memoryPool         = SlabMemoryPoolFactory.Create(this.options.MemoryPoolOptions);
     this.schedulerAllocator = new SchedulerAllocator(this.options.SchedulerCount);
 }
예제 #8
0
 protected abstract Task <TChannel> ChannelFactoryAsync(TOptions options, Action <IFilterPipeline <ITcpSession> > handler, SslFeature sslFeature);