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

[HTTP/2] Move away marking idle/non-idle from HttpConnectionPool #105876

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -288,11 +288,6 @@ public bool TryReserveStream()

if (_streamsInUse < _maxConcurrentStreams)
{
if (_streamsInUse == 0)
{
MarkConnectionAsNotIdle();
}

_streamsInUse++;
return true;
}
Expand Down Expand Up @@ -324,8 +319,6 @@ public void ReleaseStream()

if (_streamsInUse == 0)
{
MarkConnectionAsIdle();

if (_shutdown)
{
FinalTeardown();
Expand Down Expand Up @@ -1606,6 +1599,11 @@ private void AddStream(Http2Stream http2Stream)
ThrowRetry(SR.net_http_request_aborted);
}

if (_httpStreams.Count == 0)
{
MarkConnectionAsNotIdle();
}

// Now that we're holding the lock, configure the stream. The lock must be held while
// assigning the stream ID to ensure only one stream gets an ID, and it must be held
// across setting the initial window size (available credit) and storing the stream into
Expand Down Expand Up @@ -2072,6 +2070,11 @@ private void RemoveStream(Http2Stream http2Stream)
Debug.Fail($"Stream {http2Stream.StreamId} not found in dictionary during RemoveStream???");
return;
}

if (_httpStreams.Count == 0)
{
MarkConnectionAsIdle();
}
}

ReleaseStream();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
Action<RecordedCounter> check2 = connectionNoLongerIdle;
Action<RecordedCounter> check3 = connectionIsActive;

if (UseVersion.Major > 1)
if (UseVersion.Major > 2)
liveans marked this conversation as resolved.
Show resolved Hide resolved
{
// With HTTP/2 and HTTP/3, the idle state change is emitted before RequestsQueueDuration.
check1 = connectionNoLongerIdle;
Expand Down