]> Cypherpunks repositories - gostls13.git/commit
net/http: fix ordering & data race in TestTransportEventTrace_h2
authorBrad Fitzpatrick <bradfitz@golang.org>
Tue, 30 Aug 2016 04:08:10 +0000 (04:08 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 30 Aug 2016 18:26:45 +0000 (18:26 +0000)
commitf42f20ad391c510ef394bc66cf3cf5bedef48e1e
tree548756eae9aa62ff40089b63eadd476b7ff075c9
parent0dae9dfb08a30983cce1114742c974077bdf5e18
net/http: fix ordering & data race in TestTransportEventTrace_h2

Ordering fix: this CL swaps the order of the log write and the channel close
in WroteRequest. I could reproduce the bug by putting a sleep between the two
when the channel close was first. It needs to happen after the log.

Data race: use the log buffer's mutex when reading too. Not really
important once the ordering fix above is fixed (since nobody is
concurrently writing anymore), but for consistency.

Fixes #16414

Change-Id: If6657884e67be90b4455c8f5a6f7bc6981999ee4
Reviewed-on: https://go-review.googlesource.com/28078
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/net/http/transport_test.go