]> Cypherpunks repositories - gostls13.git/commit
net/http: fix TestTransportMaxConnsPerHost flakes
authorMichael Fraenkel <michael.fraenkel@gmail.com>
Fri, 3 May 2019 02:59:27 +0000 (22:59 -0400)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 3 May 2019 15:58:50 +0000 (15:58 +0000)
commit0a4d352992606d3becebfa0cdac392827039b49d
tree3735a6a24c8d71345d20076d33ed6b8117cc5dcc
parent2c67cdf7cf59a685f3a5e705b6be85f32285acec
net/http: fix TestTransportMaxConnsPerHost flakes

The testcase created a race between the close of the current connection
and the client grabbing a connection for the next request. The client
may receive the current connection which may be closed during its use.
We can have the trasnport close all idle connections thereby forcing the
client to receive a new connection.

Closing idle connections did not handle cleaning up host connection
counts for http/2. We will now decrement the host connection count for
http/2 connections.

Fixes #31784

Change-Id: Iefc0d0d7ed9fa3acd8b4f42004f1579fc1de63fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/174950
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/net/http/transport.go
src/net/http/transport_test.go