In gcc/objc/: 2011-04-15 Nicola Pero <nicola.pero@meta-innovation.com>
[official-gcc.git] / libgo / go / http / export_test.go
bloba76b70760dfa98b815b0f708f14063c1b55ae2c7
1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // Bridge package to expose http internals to tests in the http_test
6 // package.
8 package http
10 func (t *Transport) IdleConnKeysForTesting() (keys []string) {
11 keys = make([]string, 0)
12 t.lk.Lock()
13 defer t.lk.Unlock()
14 if t.idleConn == nil {
15 return
17 for key, _ := range t.idleConn {
18 keys = append(keys, key)
20 return
23 func (t *Transport) IdleConnCountForTesting(cacheKey string) int {
24 t.lk.Lock()
25 defer t.lk.Unlock()
26 if t.idleConn == nil {
27 return 0
29 conns, ok := t.idleConn[cacheKey]
30 if !ok {
31 return 0
33 return len(conns)