1
0
mirror of https://github.com/golang/go synced 2024-11-17 20:04:47 -07:00

net/http: stop timeout timer if user cancels a request

Change-Id: I84faeae69f294b9a70e545faac6a070feba67770
Reviewed-on: https://go-review.googlesource.com/28074
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Brad Fitzpatrick 2016-08-30 01:09:32 +00:00
parent 6f43a989b0
commit 2af00eb63c

View File

@ -329,6 +329,7 @@ func setRequestCancel(req *Request, rt RoundTripper, deadline time.Time) (stopTi
select {
case <-initialReqCancel:
doCancel()
timer.Stop()
case <-timer.C:
doCancel()
case <-stopTimerCh: