diff options
author | Damien Neil <dneil@google.com> | 2024-05-10 13:41:45 -0700 |
---|---|---|
committer | Damien Neil <dneil@google.com> | 2024-05-13 18:16:53 +0000 |
commit | 2c14f519f32ffdd5fbd65a090dc495a85369a177 (patch) | |
tree | 5e00efef009f56c047a605d157a8548a9e2fc301 | |
parent | ac9987996285eb37e5176356621eec4f5c9b8e83 (diff) | |
download | golang-x-net-upstream-master.tar.gz |
http2: drop the gate typeupstream-master
Drop a trivial "gate" type used in exactly one location,
replacing it with an equivalent channel operation.
We've been using a "gate" with a different definition in
the quic package; dropping this hapax legomenon type from
the http2 package frees up the name if we want to use the
same gate here.
Change-Id: Id9c7d05daf7ee920c38090df960822fcc1168a4d
Reviewed-on: https://go-review.googlesource.com/c/net/+/584896
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
-rw-r--r-- | http2/http2.go | 6 | ||||
-rw-r--r-- | http2/server.go | 4 |
2 files changed, 2 insertions, 8 deletions
diff --git a/http2/http2.go b/http2/http2.go index 6f2df28..6f90f98 100644 --- a/http2/http2.go +++ b/http2/http2.go @@ -210,12 +210,6 @@ type stringWriter interface { WriteString(s string) (n int, err error) } -// A gate lets two goroutines coordinate their activities. -type gate chan struct{} - -func (g gate) Done() { g <- struct{}{} } -func (g gate) Wait() { <-g } - // A closeWaiter is like a sync.WaitGroup but only goes 1 to 0 (open to closed). type closeWaiter chan struct{} diff --git a/http2/server.go b/http2/server.go index d2f14b1..02830d3 100644 --- a/http2/server.go +++ b/http2/server.go @@ -811,8 +811,8 @@ type readFrameResult struct { // consumer is done with the frame. // It's run on its own goroutine. func (sc *serverConn) readFrames() { - gate := make(gate) - gateDone := gate.Done + gate := make(chan struct{}) + gateDone := func() { gate <- struct{}{} } for { f, err := sc.framer.ReadFrame() select { |