bug(cloudflared): Set the MaxIdleConnsPerHost of http.Transport to proxy-keepalive-connections (#155)
Setting the MaxIdleConns is not enough, the MaxIdleConnsPerHost must be set as well. Otherwise, http.Transport will use the DefaultMaxIdleConnsPerHost, which is 2, and then the connection pool will have only 2 connection hold.
This commit is contained in:
parent
6aa48d2eb2
commit
cc2a1d1204
|
@ -197,6 +197,7 @@ func prepareTunnelConfig(
|
||||||
httpTransport := &http.Transport{
|
httpTransport := &http.Transport{
|
||||||
Proxy: http.ProxyFromEnvironment,
|
Proxy: http.ProxyFromEnvironment,
|
||||||
MaxIdleConns: c.Int("proxy-keepalive-connections"),
|
MaxIdleConns: c.Int("proxy-keepalive-connections"),
|
||||||
|
MaxIdleConnsPerHost: c.Int("proxy-keepalive-connections"),
|
||||||
IdleConnTimeout: c.Duration("proxy-keepalive-timeout"),
|
IdleConnTimeout: c.Duration("proxy-keepalive-timeout"),
|
||||||
TLSHandshakeTimeout: c.Duration("proxy-tls-timeout"),
|
TLSHandshakeTimeout: c.Duration("proxy-tls-timeout"),
|
||||||
ExpectContinueTimeout: 1 * time.Second,
|
ExpectContinueTimeout: 1 * time.Second,
|
||||||
|
|
Loading…
Reference in New Issue