Exemplo n.º 1
0
 private static PipeOptions GetInputPipeOptions(ServiceContext serviceContext, MemoryPool <byte> memoryPool, PipeScheduler writerScheduler) => new PipeOptions
 (
     pool: memoryPool,
     readerScheduler: serviceContext.Scheduler,
     writerScheduler: writerScheduler,
     pauseWriterThreshold: serviceContext.ServerOptions.Limits.MaxRequestBufferSize ?? 0,
     resumeWriterThreshold: serviceContext.ServerOptions.Limits.MaxRequestBufferSize ?? 0,
     useSynchronizationContext: false,
     minimumSegmentSize: memoryPool.GetMinimumSegmentSize()
 );
Exemplo n.º 2
0
 private static PipeOptions GetOutputPipeOptions(ServiceContext serviceContext, MemoryPool <byte> memoryPool, PipeScheduler readerScheduler) => new PipeOptions
 (
     pool: memoryPool,
     readerScheduler: readerScheduler,
     writerScheduler: serviceContext.Scheduler,
     pauseWriterThreshold: GetOutputResponseBufferSize(serviceContext),
     resumeWriterThreshold: GetOutputResponseBufferSize(serviceContext),
     useSynchronizationContext: false,
     minimumSegmentSize: memoryPool.GetMinimumSegmentSize()
 );
        private SslDuplexPipe CreateSslDuplexPipe(IDuplexPipe transport, MemoryPool <byte> memoryPool)
        {
            var inputPipeOptions = new StreamPipeReaderOptions
                                   (
                pool: memoryPool,
                bufferSize: memoryPool.GetMinimumSegmentSize(),
                minimumReadSize: memoryPool.GetMinimumAllocSize(),
                leaveOpen: true
                                   );

            var outputPipeOptions = new StreamPipeWriterOptions
                                    (
                pool: memoryPool,
                leaveOpen: true
                                    );

            return(new SslDuplexPipe(transport, inputPipeOptions, outputPipeOptions, _sslStreamFactory));
        }
Exemplo n.º 4
0
 public static int GetMinimumAllocSize(this MemoryPool <byte> pool)
 {
     // 1/2 of a segment
     return(pool.GetMinimumSegmentSize() / 2);
 }
Exemplo n.º 5
0
 // 1/2 of a segment
 public static int GetMinimumAllocSize(this MemoryPool <byte> pool) => pool.GetMinimumSegmentSize() / 2;