diff --git a/http2/server.go b/http2/server.go index 79f4edfa1..ca77d71d1 100644 --- a/http2/server.go +++ b/http2/server.go @@ -2276,8 +2276,9 @@ func (w *responseWriter) CloseNotify() <-chan bool { if ch == nil { ch = make(chan bool, 1) rws.closeNotifierCh = ch + cw := rws.stream.cw go func() { - rws.stream.cw.Wait() // wait for close + cw.Wait() // wait for close ch <- true }() }