diff --git a/pkg/httpclient/conn.go b/pkg/httpclient/conn.go index d6d6f42c5..f9324db9d 100644 --- a/pkg/httpclient/conn.go +++ b/pkg/httpclient/conn.go @@ -14,14 +14,14 @@ type Conn struct { // Read will read from the conn. func (c *Conn) Read(buf []byte) (n int, err error) { - err = c.SetReadDeadline(time.Now().Add(c.readTimeout)) + err = c.SetDeadline(time.Now().Add(c.readTimeout)) if err != nil { return } defer func() { // Clean read timeout so that this will not affect further read // It's safe to ignore the returning error: even if it don’t return now, it will return via next read. - _ = c.SetReadDeadline(time.Time{}) + _ = c.SetDeadline(time.Time{}) }() return c.Conn.Read(buf) @@ -29,14 +29,14 @@ func (c *Conn) Read(buf []byte) (n int, err error) { // Write will write into the conn. func (c *Conn) Write(buf []byte) (n int, err error) { - err = c.SetWriteDeadline(time.Now().Add(c.writeTimeout)) + err = c.SetDeadline(time.Now().Add(c.writeTimeout)) if err != nil { return } defer func() { // Clean read timeout so that this will not affect further write // It's safe to ignore the returning error: even if it don’t return now, it will return via next write. - _ = c.SetWriteDeadline(time.Time{}) + _ = c.SetDeadline(time.Time{}) }() return c.Conn.Write(buf)