-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Description
client.go clientDoDeadline routinue (G0) raise a routinue (G1) to recive response, and start a new timer according to deadline。G0 will wait for response and timer。But the connection for reading response will timeout before the deadline, because the connection will be set deadline when client's ReadTimeout/WriteTimeout is set.
//func (c *HostClient) doNonNilReqResp(req *Request, resp *Response) (bool, error) {
if c.WriteTimeout > 0 {
// Set Deadline every time, since golang has fixed the performance issue
// See https://github.com/golang/go/issues/15133#issuecomment-271571395 for details
currentTime := time.Now()
if err = conn.SetWriteDeadline(currentTime.Add(c.WriteTimeout)); err != nil {
c.closeConn(cc)
return true, err
}
}
if c.ReadTimeout > 0 {
// Set Deadline every time, since golang has fixed the performance issue
// See https://github.com/golang/go/issues/15133#issuecomment-271571395 for details
currentTime := time.Now()
if err = conn.SetReadDeadline(currentTime.Add(c.ReadTimeout)); err != nil {
c.closeConn(cc)
return true, err
}
}Metadata
Metadata
Assignees
Labels
No labels