From 4c8ac8a5691b57f43cff4df221736df159646400 Mon Sep 17 00:00:00 2001 From: Will Hawkins Date: Tue, 23 May 2023 18:00:07 -0400 Subject: [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. --- utilities/transport.go | 7 +++++-- 1 file 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 + } } -- cgit v1.2.3