pool.mu.Lock()
defer pool.mu.Unlock()
- for k, cc := range pool.conns {
- for range cc {
- ret = append(ret, k)
+ for k, ccs := range pool.conns {
+ for _, cc := range ccs {
+ if cc.idleState().canTakeNewRequest {
+ ret = append(ret, k)
+ }
}
}
type http2clientConnPool struct {
mu *sync.Mutex
- conns map[string][]struct{}
+ conns map[string][]*http2clientConn
}
+type http2clientConn struct{}
+
+type http2clientConnIdleState struct {
+ canTakeNewRequest bool
+}
+
+func (cc *http2clientConn) idleState() http2clientConnIdleState { return http2clientConnIdleState{} }
+
func http2configureTransports(*Transport) (*http2Transport, error) { panic(noHTTP2) }
func http2isNoCachedConnError(err error) bool {
}
var conn string
- doReq := func(n int) (ok bool) {
+ doReq := func(n int) (timeoutOk bool) {
req, _ := NewRequest("GET", cst.ts.URL, nil)
req = req.WithContext(httptrace.WithClientTrace(context.Background(), &httptrace.ClientTrace{
PutIdleConn: func(err error) {
waitCondition(t, timeout/2, func(d time.Duration) bool {
if got := idleConns(); len(got) != 0 {
if d >= timeout*3/2 {
- t.Logf("after %d, idle conns = %q", d, got)
+ t.Logf("after %v, idle conns = %q", d, got)
}
return false
}