OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [go/] [net/] [http/] [export_test.go] - Blame information for rev 747

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
// 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.
4
 
5
// Bridge package to expose http internals to tests in the http_test
6
// package.
7
 
8
package http
9
 
10
import "time"
11
 
12
func (t *Transport) IdleConnKeysForTesting() (keys []string) {
13
        keys = make([]string, 0)
14
        t.lk.Lock()
15
        defer t.lk.Unlock()
16
        if t.idleConn == nil {
17
                return
18
        }
19
        for key := range t.idleConn {
20
                keys = append(keys, key)
21
        }
22
        return
23
}
24
 
25
func (t *Transport) IdleConnCountForTesting(cacheKey string) int {
26
        t.lk.Lock()
27
        defer t.lk.Unlock()
28
        if t.idleConn == nil {
29
                return 0
30
        }
31
        conns, ok := t.idleConn[cacheKey]
32
        if !ok {
33
                return 0
34
        }
35
        return len(conns)
36
}
37
 
38
func NewTestTimeoutHandler(handler Handler, ch <-chan time.Time) Handler {
39
        f := func() <-chan time.Time {
40
                return ch
41
        }
42
        return &timeoutHandler{handler, f, ""}
43
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.