|
@@ -18,6 +18,18 @@ type ClientConnPool interface {
|
|
|
MarkDead(*ClientConn)
|
|
MarkDead(*ClientConn)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// clientConnPoolIdleCloser is the interface implemented by ClientConnPool
|
|
|
|
|
+// implementations which can close their idle connections.
|
|
|
|
|
+type clientConnPoolIdleCloser interface {
|
|
|
|
|
+ ClientConnPool
|
|
|
|
|
+ closeIdleConnections()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+var (
|
|
|
|
|
+ _ clientConnPoolIdleCloser = (*clientConnPool)(nil)
|
|
|
|
|
+ _ clientConnPoolIdleCloser = noDialClientConnPool{}
|
|
|
|
|
+)
|
|
|
|
|
+
|
|
|
// TODO: use singleflight for dialing and addConnCalls?
|
|
// TODO: use singleflight for dialing and addConnCalls?
|
|
|
type clientConnPool struct {
|
|
type clientConnPool struct {
|
|
|
t *Transport
|
|
t *Transport
|
|
@@ -223,3 +235,12 @@ func filterOutClientConn(in []*ClientConn, exclude *ClientConn) []*ClientConn {
|
|
|
}
|
|
}
|
|
|
return out
|
|
return out
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+// noDialClientConnPool is an implementation of http2.ClientConnPool
|
|
|
|
|
+// which never dials. We let the HTTP/1.1 client dial and use its TLS
|
|
|
|
|
+// connection instead.
|
|
|
|
|
+type noDialClientConnPool struct{ *clientConnPool }
|
|
|
|
|
+
|
|
|
|
|
+func (p noDialClientConnPool) GetClientConn(req *http.Request, addr string) (*ClientConn, error) {
|
|
|
|
|
+ return p.getClientConn(req, addr, noDialOnMiss)
|
|
|
|
|
+}
|