Merge pull request #8035 from duglin/Issue7965

Add timeout to client - fix for #7965
Upstream-commit: eb21197c6b4981db3cc2ad95694f92d723d34e2f
Component: engine
This commit is contained in:
Alexandr Morozov
2014-09-17 01:55:48 +04:00

View File

@ -16,6 +16,7 @@ import (
"strconv"
"strings"
"syscall"
"time"
"github.com/docker/docker/api"
"github.com/docker/docker/dockerversion"
@ -34,7 +35,8 @@ func (cli *DockerCli) HTTPClient() *http.Client {
tr := &http.Transport{
TLSClientConfig: cli.tlsConfig,
Dial: func(network, addr string) (net.Conn, error) {
return net.Dial(cli.proto, cli.addr)
// Why 32? See issue 8035
return net.DialTimeout(cli.proto, cli.addr, 32*time.Second)
},
}
return &http.Client{Transport: tr}