Exemple #1
0
        public Task OnConnectionAsync(MultiplexedConnectionContext connectionContext)
        {
            var memoryPoolFeature = connectionContext.Features.Get <IMemoryPoolFeature>();

            var httpConnectionContext = new HttpMultiplexedConnectionContext(
                connectionContext.ConnectionId,
                connectionContext,
                _serviceContext,
                connectionContext.Features,
                memoryPoolFeature?.MemoryPool ?? System.Buffers.MemoryPool <byte> .Shared,
                connectionContext.LocalEndPoint as IPEndPoint,
                connectionContext.RemoteEndPoint as IPEndPoint);

            var connection = new HttpConnection(httpConnectionContext);

            return(connection.ProcessRequestsAsync(_application));
        }
        public Task OnConnectionAsync(MultiplexedConnectionContext connectionContext)
        {
            var memoryPoolFeature = connectionContext.Features.Get <IMemoryPoolFeature>();
            var localEndPoint     = connectionContext.LocalEndPoint as IPEndPoint;
            var altSvcHeader      = _addAltSvcHeader && localEndPoint != null?HttpUtilities.GetEndpointAltSvc(localEndPoint, _protocols) : null;

            var httpConnectionContext = new HttpMultiplexedConnectionContext(
                connectionContext.ConnectionId,
                _protocols,
                altSvcHeader,
                connectionContext,
                _serviceContext,
                connectionContext.Features,
                memoryPoolFeature?.MemoryPool ?? System.Buffers.MemoryPool <byte> .Shared,
                localEndPoint,
                connectionContext.RemoteEndPoint as IPEndPoint);

            var connection = new HttpConnection(httpConnectionContext);

            return(connection.ProcessRequestsAsync(_application));
        }