예제 #1
0
        public override void Dispose()
        {
            // Close any remaining request streams (but NOT control streams, as these should not be closed while the connection is open)
            foreach (Http3LoopbackStream stream in _openStreams.Values)
            {
                stream.Dispose();
            }

            foreach (QuicStream stream in _delayedStreams)
            {
                stream.Dispose();
            }

            // We don't dispose the connection currently, because this causes races when the server connection is closed before
            // the client has received and handled all response data.
            // See discussion in https://github.com/dotnet/runtime/pull/57223#discussion_r687447832
#if false
            // Dispose the connection
            // If we already waited for graceful shutdown from the client, then the connection is already closed and this will simply release the handle.
            // If not, then this will silently abort the connection.
            _connection.Dispose();

            // Dispose control streams so that we release their handles too.
            _inboundControlStream?.Dispose();
            _outboundControlStream?.Dispose();
#endif
        }
예제 #2
0
        public override async Task SendResponseBodyAsync(byte[] content, bool isFinal = true, int requestId = 0)
        {
            Http3LoopbackStream stream = GetOpenRequest(requestId);

            if (content?.Length != 0)
            {
                await stream.SendDataFrameAsync(content).ConfigureAwait(false);
            }

            if (isFinal)
            {
                stream.ShutdownSend();
                stream.Dispose();
            }
        }