mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #8035 from duglin/Issue7965
Add timeout to client - fix for #7965
This commit is contained in:
commit
eb21197c6b
1 changed files with 3 additions and 1 deletions
|
@ -16,6 +16,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/api"
|
"github.com/docker/docker/api"
|
||||||
"github.com/docker/docker/dockerversion"
|
"github.com/docker/docker/dockerversion"
|
||||||
|
@ -34,7 +35,8 @@ func (cli *DockerCli) HTTPClient() *http.Client {
|
||||||
tr := &http.Transport{
|
tr := &http.Transport{
|
||||||
TLSClientConfig: cli.tlsConfig,
|
TLSClientConfig: cli.tlsConfig,
|
||||||
Dial: func(network, addr string) (net.Conn, error) {
|
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}
|
return &http.Client{Transport: tr}
|
||||||
|
|
Loading…
Add table
Reference in a new issue