private async Task WriteOutputAsync(LibuvOutputConsumer consumer, PipeReader outputReader, Http1Connection http1Connection)
        {
            // This WriteOutputAsync() calling code is equivalent to that in LibuvConnection.
            try
            {
                // Ensure that outputReader.Complete() runs on the LibuvThread.
                // Without ConfigureAwait(false), xunit will dispatch.
                await consumer.WriteOutputAsync().ConfigureAwait(false);

                http1Connection.Abort(error: null);
                outputReader.Complete();
            }
            catch (UvException ex)
            {
                http1Connection.Abort(ex);
                outputReader.Complete(ex);
            }
        }
Пример #2
0
        public void Abort(Exception ex)
        {
            Debug.Assert(_http1Connection != null, $"{nameof(_http1Connection)} is null");
            Debug.Assert(_http2Connection != null, $"{nameof(_http2Connection)} is null");

            // Abort the connection (if not already aborted)
            if (Interlocked.Exchange(ref _http2ConnectionState, Http2ConnectionClosed) == Http2ConnectionStarted)
            {
                _http2Connection.Abort(ex);
            }
            else
            {
                _http1Connection.Abort(ex);
            }
        }