Merge pull request #19971 from aaronlehmann/revert-19743
Revert "Set idle timeouts for HTTP reads and writes in communications with the registry"
This commit is contained in:
commit
3fa0d09e74
|
@ -45,30 +45,6 @@ func (dcs dumbCredentialStore) Basic(*url.URL) (string, string) {
|
||||||
return dcs.auth.Username, dcs.auth.Password
|
return dcs.auth.Username, dcs.auth.Password
|
||||||
}
|
}
|
||||||
|
|
||||||
// conn wraps a net.Conn, and sets a deadline for every read
|
|
||||||
// and write operation.
|
|
||||||
type conn struct {
|
|
||||||
net.Conn
|
|
||||||
readTimeout time.Duration
|
|
||||||
writeTimeout time.Duration
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *conn) Read(b []byte) (int, error) {
|
|
||||||
err := c.Conn.SetReadDeadline(time.Now().Add(c.readTimeout))
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
return c.Conn.Read(b)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *conn) Write(b []byte) (int, error) {
|
|
||||||
err := c.Conn.SetWriteDeadline(time.Now().Add(c.writeTimeout))
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
return c.Conn.Write(b)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewV2Repository returns a repository (v2 only). It creates a HTTP transport
|
// NewV2Repository returns a repository (v2 only). It creates a HTTP transport
|
||||||
// providing timeout settings and authentication support, and also verifies the
|
// providing timeout settings and authentication support, and also verifies the
|
||||||
// remote API version.
|
// remote API version.
|
||||||
|
@ -82,22 +58,11 @@ func NewV2Repository(ctx context.Context, repoInfo *registry.RepositoryInfo, end
|
||||||
// TODO(dmcgowan): Call close idle connections when complete, use keep alive
|
// TODO(dmcgowan): Call close idle connections when complete, use keep alive
|
||||||
base := &http.Transport{
|
base := &http.Transport{
|
||||||
Proxy: http.ProxyFromEnvironment,
|
Proxy: http.ProxyFromEnvironment,
|
||||||
Dial: func(network, address string) (net.Conn, error) {
|
Dial: (&net.Dialer{
|
||||||
dialer := &net.Dialer{
|
Timeout: 30 * time.Second,
|
||||||
Timeout: 30 * time.Second,
|
KeepAlive: 30 * time.Second,
|
||||||
KeepAlive: 30 * time.Second,
|
DualStack: true,
|
||||||
DualStack: true,
|
}).Dial,
|
||||||
}
|
|
||||||
netConn, err := dialer.Dial(network, address)
|
|
||||||
if err != nil {
|
|
||||||
return netConn, err
|
|
||||||
}
|
|
||||||
return &conn{
|
|
||||||
Conn: netConn,
|
|
||||||
readTimeout: time.Minute,
|
|
||||||
writeTimeout: time.Minute,
|
|
||||||
}, nil
|
|
||||||
},
|
|
||||||
TLSHandshakeTimeout: 10 * time.Second,
|
TLSHandshakeTimeout: 10 * time.Second,
|
||||||
TLSClientConfig: endpoint.TLSConfig,
|
TLSClientConfig: endpoint.TLSConfig,
|
||||||
// TODO(dmcgowan): Call close idle connections when complete and use keep alive
|
// TODO(dmcgowan): Call close idle connections when complete and use keep alive
|
||||||
|
|
Loading…
Reference in New Issue