Skip to content
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

Flaky multiple HTTP/2 connection tests read full request body #40844

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2237,23 +2237,24 @@ private static async Task<Http2LoopbackConnection> GetConnection(Http2LoopbackSe

private async Task<(int Count, int LastStreamId)> HandleAllPendingRequests(Http2LoopbackConnection connection, int totalRequestCount)
{
int streamId = -1;
int lastStreamId = -1;
for (int i = 0; i < totalRequestCount; i++)
{
try
{
// Exact number of requests sent over the given connection is unknown,
// so we keep reading headers and sending response while there are available requests.
streamId = await connection.ReadRequestHeaderAsync().ConfigureAwait(false);
(int streamId, _) = await connection.ReadAndParseRequestHeaderAsync().ConfigureAwait(false);
await connection.SendDefaultResponseAsync(streamId).ConfigureAwait(false);
lastStreamId = streamId;
}
catch (OperationCanceledException)
{
return (i, streamId);
return (i, lastStreamId);
}
}

return (totalRequestCount, streamId);
return (totalRequestCount, lastStreamId);
}

private async Task<List<int>> AcceptRequests(Http2LoopbackConnection connection, int maxRequests = int.MaxValue)
Expand All @@ -2263,7 +2264,8 @@ private async Task<List<int>> AcceptRequests(Http2LoopbackConnection connection,
{
try
{
streamIds.Add(await connection.ReadRequestHeaderAsync().ConfigureAwait(false));
(int streamId, _) = await connection.ReadAndParseRequestHeaderAsync().ConfigureAwait(false);
streamIds.Add(streamId);
}
catch (OperationCanceledException)
{
Expand Down