diff options
| author | Daniel Morsing <daniel.morsing@gmail.com> | 2015-04-20 23:02:07 +0100 |
|---|---|---|
| committer | Daniel Morsing <daniel.morsing@gmail.com> | 2015-04-22 12:23:55 +0000 |
| commit | 723f86537c362f2f86c82ae827f689c23b866f00 (patch) | |
| tree | c9d9d51a09d6a7a134ca87cfbc67a9cd444333c3 /src/net/http/export_test.go | |
| parent | 5fa2d9915f8311d7996e93a3a42cf438278e3886 (diff) | |
| download | go-723f86537c362f2f86c82ae827f689c23b866f00.tar.xz | |
net/http: fix race between dialing and canceling
In the brief window between getConn and persistConn.roundTrip,
a cancel could end up going missing.
Fix by making it possible to inspect if a cancel function was cleared
and checking if we were canceled before entering roundTrip.
Fixes #10511
Change-Id: If6513e63fbc2edb703e36d6356ccc95a1dc33144
Reviewed-on: https://go-review.googlesource.com/9181
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/net/http/export_test.go')
| -rw-r--r-- | src/net/http/export_test.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/net/http/export_test.go b/src/net/http/export_test.go index 69757bdca6..b656aa9731 100644 --- a/src/net/http/export_test.go +++ b/src/net/http/export_test.go @@ -82,6 +82,10 @@ func SetInstallConnClosedHook(f func()) { testHookPersistConnClosedGotRes = f } +func SetEnterRoundTripHook(f func()) { + testHookEnterRoundTrip = f +} + func NewTestTimeoutHandler(handler Handler, ch <-chan time.Time) Handler { f := func() <-chan time.Time { return ch |
