Remove CreditManager from Http2Stream (#32624)
authorStephen Toub <stoub@microsoft.com>
Fri, 21 Feb 2020 18:08:13 +0000 (13:08 -0500)
committerGitHub <noreply@github.com>
Fri, 21 Feb 2020 18:08:13 +0000 (13:08 -0500)
commit857529d5eb5f58e70ad7ffda0676d9e866a67d81
tree97497ac17cdd943041bf837cd27c3a2c3d60aff0
parentb2de9fa4cc59cd3cc783d3c090749cf6c43ce43a
Remove CreditManager from Http2Stream (#32624)

The CreditManager implementation supports multiple awaiters, but Http2Stream's CreditManager never has more than one waiter at a time.  We can instead just encode similar logic into Http2Stream, and make its waiter a reusable singleton, such that if we have to allocate it, we can just keep reusing it for all subsequent waits.  This means we avoid the CreditManager allocation per Http2Stream as well as the Waiter allocation per wait (other than the first).
src/libraries/System.Net.Http/src/System.Net.Http.csproj
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/CreditManager.cs
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/CreditWaiter.cs [new file with mode: 0644]
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2Stream.cs