diff options
author | Andy Pan <panjf2000@gmail.com> | 2022-11-16 12:13:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-16 06:13:29 +0200 |
commit | b32a3dda13b7dcbd6e695254a9b9001434582ccf (patch) | |
tree | f6eb35a9d1b666adb95d096133a24b341696954f /client.go | |
parent | Assert with *net.TCPConn instead of *net.TCPListener in acceptConn() for TCP ... (diff) | |
download | fasthttp-b32a3dda13b7dcbd6e695254a9b9001434582ccf.tar.gz fasthttp-b32a3dda13b7dcbd6e695254a9b9001434582ccf.tar.bz2 fasthttp-b32a3dda13b7dcbd6e695254a9b9001434582ccf.zip |
Use time.Until(deadline) instead of -time.Since(deadline) (#1434)
Diffstat (limited to 'client.go')
-rw-r--r-- | client.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -907,7 +907,7 @@ type clientURLResponse struct { } func clientGetURLDeadline(dst []byte, url string, deadline time.Time, c clientDoer) (statusCode int, body []byte, err error) { - timeout := -time.Since(deadline) + timeout := time.Until(deadline) if timeout <= 0 { return 0, dst, ErrTimeout } @@ -2361,7 +2361,7 @@ func (c *PipelineClient) DoDeadline(req *Request, resp *Response, deadline time. func (c *pipelineConnClient) DoDeadline(req *Request, resp *Response, deadline time.Time) error { c.init() - timeout := -time.Since(deadline) + timeout := time.Until(deadline) if timeout < 0 { return ErrTimeout } |