diff options
| author | Will Hawkins <[email protected]> | 2023-05-23 18:00:07 -0400 |
|---|---|---|
| committer | Will Hawkins <[email protected]> | 2023-06-02 10:10:46 -0400 |
| commit | 4c8ac8a5691b57f43cff4df221736df159646400 (patch) | |
| tree | 2843e76330847193b40fe2573d59c01d0b820f62 | |
| parent | 6ed3213da8666b9e4e51ae232f2109663d28306e (diff) | |
[Bugfix] Global adherence to max concurrent streams
If a connection in a connection pool is asked for an additional stream
that puts it over the limit of the max concurrent connections, the
connection pool will spawn a new connection. This behavior is not what
we want -- we would prefer that the new connection just wait its turn.
Setting the `http2/Transport.StrictMaxConcurrentStreams` flag will
accomplish that.
| -rw-r--r-- | utilities/transport.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/utilities/transport.go b/utilities/transport.go index 2d70989..8e890d0 100644 --- a/utilities/transport.go +++ b/utilities/transport.go @@ -41,6 +41,9 @@ func OverrideHostTransport(transport *http.Transport, connectToAddr string) { return dialer.DialContext(ctx, network, addr) } - http2.ConfigureTransport(transport) - + if t2, err := http2.ConfigureTransports(transport); err != nil { + panic("Panic: Could not properly upgrade an http/1.1 transport for http/2.") + } else { + t2.StrictMaxConcurrentStreams = true + } } |
