コード例 #1
0
 public Http3RequestStream(Http3InMemory testBase, Http3Connection connection, TestStreamContext testStreamContext, Http3RequestHeaderHandler headerHandler)
     : base(testStreamContext)
 {
     TestBase            = testBase;
     Connection          = connection;
     _streamId           = testStreamContext.StreamId;
     _testStreamContext  = testStreamContext;
     this._headerHandler = headerHandler;
 }
コード例 #2
0
            public Http3RequestStream(Http3TestBase testBase, Http3Connection connection)
            {
                _testBase   = testBase;
                _connection = connection;
                var inputPipeOptions  = GetInputPipeOptions(_testBase._serviceContext, _testBase._memoryPool, PipeScheduler.ThreadPool);
                var outputPipeOptions = GetOutputPipeOptions(_testBase._serviceContext, _testBase._memoryPool, PipeScheduler.ThreadPool);

                _pair = DuplexPipe.CreateConnectionPair(inputPipeOptions, outputPipeOptions);

                StreamContext = new TestStreamContext(canRead: true, canWrite: true, _pair, this);
            }
コード例 #3
0
        internal ValueTask <Http3RequestStream> CreateRequestStream(Http3RequestHeaderHandler headerHandler = null)
        {
            if (!_streamContextPool.TryDequeue(out var testStreamContext))
            {
                testStreamContext = new TestStreamContext(canRead: true, canWrite: true, this);
            }
            testStreamContext.Initialize(GetStreamId(0x00));

            var stream = new Http3RequestStream(this, Connection, testStreamContext, headerHandler ?? new Http3RequestHeaderHandler());

            _runningStreams[stream.StreamId] = stream;

            MultiplexedConnectionContext.ToServerAcceptQueue.Writer.TryWrite(stream.StreamContext);
            return(new ValueTask <Http3RequestStream>(stream));
        }
コード例 #4
0
    private Http3RequestStream CreateRequestStreamCore(Http3RequestHeaderHandler headerHandler)
    {
        var requestStreamId = GetStreamId(0x00);

        if (!_streamContextPool.TryDequeue(out var testStreamContext))
        {
            testStreamContext = new TestStreamContext(canRead: true, canWrite: true, this);
        }
        else
        {
            Logger.LogDebug($"Reusing context for request stream {requestStreamId}.");
        }
        testStreamContext.Initialize(requestStreamId);

        return(new Http3RequestStream(this, Connection, testStreamContext, headerHandler ?? new Http3RequestHeaderHandler()));
    }
コード例 #5
0
        internal async ValueTask <Http3ControlStream> CreateControlStream(int?id)
        {
            var testStreamContext = new TestStreamContext(canRead: true, canWrite: false, this);

            testStreamContext.Initialize(streamId: 2);

            var stream = new Http3ControlStream(this, testStreamContext);

            _runningStreams[stream.StreamId] = stream;

            MultiplexedConnectionContext.ToServerAcceptQueue.Writer.TryWrite(stream.StreamContext);
            if (id != null)
            {
                await stream.WriteStreamIdAsync(id.GetValueOrDefault());
            }
            return(stream);
        }
コード例 #6
0
 public Http3ControlStream(Http3InMemory testBase, TestStreamContext testStreamContext)
     : base(testStreamContext)
 {
     TestBase  = testBase;
     _streamId = testStreamContext.StreamId;
 }