Beispiel #1
0
        private async ValueTask <Http3ControlStream> CreateNewUnidirectionalStreamAsync <TContext>(IHttpApplication <TContext> application) where TContext : notnull
        {
            var features = new FeatureCollection();

            features.Set <IStreamDirectionFeature>(new DefaultStreamDirectionFeature(canRead: false, canWrite: true));
            var streamContext = await _multiplexedContext.ConnectAsync(features);

            var httpConnectionContext = new Http3StreamContext(
                _multiplexedContext.ConnectionId,
                HttpProtocols.Http3,
                _context.AltSvcHeader,
                _multiplexedContext,
                _context.ServiceContext,
                streamContext.Features,
                _context.MemoryPool,
                streamContext.LocalEndPoint as IPEndPoint,
                streamContext.RemoteEndPoint as IPEndPoint,
                _streamLifetimeHandler,
                streamContext,
                _clientSettings,
                _serverSettings);

            httpConnectionContext.TimeoutControl = _context.TimeoutControl;
            httpConnectionContext.Transport      = streamContext.Transport;

            return(new Http3ControlStream <TContext>(application, httpConnectionContext));
        }
Beispiel #2
0
        private async ValueTask <Http3ControlStream> CreateNewUnidirectionalStreamAsync <TContext>(IHttpApplication <TContext> application)
        {
            var features = new FeatureCollection();

            features.Set <IStreamDirectionFeature>(new DefaultStreamDirectionFeature(canRead: false, canWrite: true));
            var streamContext = await _multiplexedContext.ConnectAsync(features);

            var httpConnectionContext = new Http3StreamContext
            {
                //ConnectionId = "", TODO getting stream ID from stream that isn't started throws an exception.
                StreamContext      = streamContext,
                Protocols          = HttpProtocols.Http3,
                ServiceContext     = _context.ServiceContext,
                ConnectionFeatures = streamContext.Features,
                MemoryPool         = _context.MemoryPool,
                Transport          = streamContext.Transport,
                TimeoutControl     = _context.TimeoutControl,
                LocalEndPoint      = streamContext.LocalEndPoint as IPEndPoint,
                RemoteEndPoint     = streamContext.RemoteEndPoint as IPEndPoint
            };

            return(new Http3ControlStream <TContext>(application, this, httpConnectionContext));
        }