-
Notifications
You must be signed in to change notification settings - Fork 10.4k
HTTP/3: Request and response data rates #32127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,6 +133,11 @@ public void StopProcessingNextRequest(bool serverInitiated) | |
|
||
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. | ||
|
@@ -249,10 +254,15 @@ public void OnTimeout(TimeoutReason reason) | |
case TimeoutReason.TimeoutFeature: | ||
SendGoAway(GetHighestStreamId()).Preserve(); | ||
break; | ||
case TimeoutReason.RequestHeaders: // Request header timeout is handled in starting stream queue | ||
case TimeoutReason.KeepAlive: // Keep-alive is handled by msquic | ||
case TimeoutReason.ReadDataRate: | ||
Abort(new ConnectionAbortedException(CoreStrings.BadRequest_RequestBodyTimeout), Http3ErrorCode.InternalError); | ||
break; | ||
case TimeoutReason.WriteDataRate: | ||
Log.ResponseMinimumDataRateNotSatisfied(_context.ConnectionId, traceIdentifier: null); | ||
Abort(new ConnectionAbortedException(CoreStrings.ConnectionTimedBecauseResponseMininumDataRateNotSatisfied), Http3ErrorCode.InternalError); | ||
break; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems about the same as HttpConnection.OnTimeout(). Do you think it's worth changing Http3ConnectionMiddleware to call through HttpConnection like HttpConnectionMiddleware does? Then we could make Http3Connection an IRequestProcessor like Http1Connection and Http2Connection giving us greater consistency. HttpConnection itself is pretty small, so I think it be a fairly small change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Discussed offline. Will attempt in a follow-up PR. |
||
case TimeoutReason.RequestHeaders: // Request header timeout is handled in starting stream queue | ||
case TimeoutReason.KeepAlive: // Keep-alive is handled by msquic | ||
case TimeoutReason.RequestBodyDrain: | ||
default: | ||
Debug.Assert(false, "Invalid TimeoutReason"); | ||
|
@@ -392,6 +402,9 @@ internal async Task InnerProcessStreamsAsync<TContext>(IHttpApplication<TContext | |
{ | ||
await _streamCompletionAwaitable; | ||
} | ||
|
||
_timeoutControl.CancelTimeout(); | ||
_timeoutControl.StartDrainTimeout(Limits.MinResponseDataRate, Limits.MaxResponseBufferSize); | ||
} | ||
catch | ||
{ | ||
|
Uh oh!
There was an error while loading. Please reload this page.