Skip to content

Commit 2c14f51

Browse files
committed
http2: drop the gate type
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 <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent ac99879 commit 2c14f51

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

http2/http2.go

-6
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,6 @@ type stringWriter interface {
210210
WriteString(s string) (n int, err error)
211211
}
212212

213-
// A gate lets two goroutines coordinate their activities.
214-
type gate chan struct{}
215-
216-
func (g gate) Done() { g <- struct{}{} }
217-
func (g gate) Wait() { <-g }
218-
219213
// A closeWaiter is like a sync.WaitGroup but only goes 1 to 0 (open to closed).
220214
type closeWaiter chan struct{}
221215

http2/server.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -811,8 +811,8 @@ type readFrameResult struct {
811811
// consumer is done with the frame.
812812
// It's run on its own goroutine.
813813
func (sc *serverConn) readFrames() {
814-
gate := make(gate)
815-
gateDone := gate.Done
814+
gate := make(chan struct{})
815+
gateDone := func() { gate <- struct{}{} }
816816
for {
817817
f, err := sc.framer.ReadFrame()
818818
select {

0 commit comments

Comments
 (0)