aboutsummaryrefslogtreecommitdiff
path: root/client.go
diff options
context:
space:
mode:
authorGravatar byte0o <62271264+byte0o@users.noreply.github.com> 2023-05-14 18:55:02 +0800
committerGravatar GitHub <noreply@github.com> 2023-05-14 12:55:02 +0200
commit9bc8e480c444fa6bf54a4cd79091692ceff6011c (patch)
treeebf00c55ce5622d5c7d99db73b1151837dd26a10 /client.go
parentfix the problem: HostClient maybe delete when pendingClientRequests > 0 (#1562) (diff)
downloadfasthttp-9bc8e480c444fa6bf54a4cd79091692ceff6011c.tar.gz
fasthttp-9bc8e480c444fa6bf54a4cd79091692ceff6011c.tar.bz2
fasthttp-9bc8e480c444fa6bf54a4cd79091692ceff6011c.zip
Request timeout settings for the same domain name are reused (#1558)
* Update client.go fix client http SetReadDeadline/SetWriteDeadline Deadline is reused * delete Deadline comments fix test singleEchoConn implement SetWriteDeadline/SetReadDeadline * fix test SetReadDeadline/SetWriteDeadline none implement --------- Co-authored-by: gaoping <gaoping1@wps.cn>
Diffstat (limited to 'client.go')
-rw-r--r--client.go22
1 files changed, 8 insertions, 14 deletions
diff --git a/client.go b/client.go
index d37ed33..6069eea 100644
--- a/client.go
+++ b/client.go
@@ -1387,13 +1387,10 @@ func (c *HostClient) doNonNilReqResp(req *Request, resp *Response) (bool, error)
writeDeadline = tmpWriteDeadline
}
}
- if !writeDeadline.IsZero() {
- // Set Deadline every time, since golang has fixed the performance issue
- // See https://github.com/golang/go/issues/15133#issuecomment-271571395 for details
- if err = conn.SetWriteDeadline(writeDeadline); err != nil {
- c.closeConn(cc)
- return true, err
- }
+
+ if err = conn.SetWriteDeadline(writeDeadline); err != nil {
+ c.closeConn(cc)
+ return true, err
}
resetConnection := false
@@ -1432,13 +1429,10 @@ func (c *HostClient) doNonNilReqResp(req *Request, resp *Response) (bool, error)
readDeadline = tmpReadDeadline
}
}
- if !readDeadline.IsZero() {
- // Set Deadline every time, since golang has fixed the performance issue
- // See https://github.com/golang/go/issues/15133#issuecomment-271571395 for details
- if err = conn.SetReadDeadline(readDeadline); err != nil {
- c.closeConn(cc)
- return true, err
- }
+
+ if err = conn.SetReadDeadline(readDeadline); err != nil {
+ c.closeConn(cc)
+ return true, err
}
if customSkipBody || req.Header.IsHead() {