diff options
| author | Brad Fitzpatrick <bradfitz@golang.org> | 2016-09-29 18:05:06 -0700 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2016-09-30 14:06:32 +0000 |
| commit | 893d6866213ca539195076f0e3338da99f321c9c (patch) | |
| tree | 1e584d54e43f8026dcb37ca8305e5fc42203f72a /src/net/http/export_test.go | |
| parent | 441502154fa5f78e93c9c7985fbea78a02c21f4f (diff) | |
| download | go-893d6866213ca539195076f0e3338da99f321c9c.tar.xz | |
net/http: update bundled http2, add h2 Transport.IdleConnTimeout tests
Updates bundled http2 to x/net git rev a333c53 for:
http2: add Transport support for IdleConnTimeout
https://golang.org/cl/30075
And add tests.
The bundled http2 also includes a change adding a Ping method to
http2.ClientConn, but that type isn't exposed in the standard
library. Nevertheless, the code gets compiled and adds a dependency on
"crypto/rand", requiring an update to go/build's dependency
test. Because net/http already depends on crypto/tls, which uses
crypto/rand, it's not really a new dependency.
Fixes #16808
Change-Id: I1ec8666ea74762f27c70a6f30a366a6647f923f7
Reviewed-on: https://go-review.googlesource.com/30078
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/net/http/export_test.go')
| -rw-r--r-- | src/net/http/export_test.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/net/http/export_test.go b/src/net/http/export_test.go index 7fc3546caa..00824e754c 100644 --- a/src/net/http/export_test.go +++ b/src/net/http/export_test.go @@ -100,6 +100,24 @@ func (t *Transport) IdleConnStrsForTesting() []string { return ret } +func (t *Transport) IdleConnStrsForTesting_h2() []string { + var ret []string + noDialPool := t.h2transport.ConnPool.(http2noDialClientConnPool) + pool := noDialPool.http2clientConnPool + + pool.mu.Lock() + defer pool.mu.Unlock() + + for k, cc := range pool.conns { + for range cc { + ret = append(ret, k) + } + } + + sort.Strings(ret) + return ret +} + func (t *Transport) IdleConnCountForTesting(cacheKey string) int { t.idleMu.Lock() defer t.idleMu.Unlock() |
