public void StopProcessingNextRequest(bool serverInitiated) { bool previousState; lock (_protocolSelectionLock) { previousState = _aborted; } if (!previousState) { var initiator = serverInitiated ? GracefulCloseInitiator.Server : GracefulCloseInitiator.Client; if (Interlocked.CompareExchange(ref _gracefulCloseInitiator, initiator, GracefulCloseInitiator.None) == GracefulCloseInitiator.None) { // https://quicwg.org/base-drafts/draft-ietf-quic-http.html#section-5.2-11 // An endpoint that completes a graceful shutdown SHOULD use the H3_NO_ERROR error code // when closing the connection. _errorCodeFeature.Error = (long)Http3ErrorCode.NoError; // Abort accept async loop to initiate graceful shutdown // TODO aborting connection isn't graceful due to runtime issue, will drop data on streams // Either we need to swap to using a cts here or fix runtime to gracefully close connection. // await all stream being completed here. _multiplexedContext.Abort(); } } }
public void OnConnectionClosed() { bool previousState; lock (_protocolSelectionLock) { previousState = _aborted; } if (!previousState) { TryStopAcceptingStreams(); _multiplexedContext.Abort(new ConnectionAbortedException(CoreStrings.ConnectionAbortedByClient)); } }
public void StopProcessingNextRequest(bool serverInitiated) { bool previousState; lock (_protocolSelectionLock) { previousState = _aborted; } if (!previousState) { var initiator = serverInitiated ? GracefulCloseInitiator.Server : GracefulCloseInitiator.Client; if (Interlocked.CompareExchange(ref _gracefulCloseInitiator, initiator, GracefulCloseInitiator.None) == GracefulCloseInitiator.None) { // Abort accept async loop to initiate graceful shutdown // TODO aborting connection isn't graceful due to runtime issue, will drop data on streams // Either we need to swap to using a cts here or fix runtime to gracefully close connection. // await all stream being completed here. _multiplexedContext.Abort(); } } }