mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-27 14:49:57 +00:00
TUN-2608: h2mux.Muxer.Shutdown always returns a non-nil channel
This commit is contained in:
@@ -51,10 +51,12 @@ type MuxReader struct {
|
||||
dictionaries h2Dictionaries
|
||||
}
|
||||
|
||||
func (r *MuxReader) Shutdown() {
|
||||
done := r.streams.Shutdown()
|
||||
if done == nil {
|
||||
return
|
||||
// Shutdown blocks new streams from being created.
|
||||
// It returns a channel that is closed once the last stream has closed.
|
||||
func (r *MuxReader) Shutdown() <-chan struct{} {
|
||||
done, alreadyInProgress := r.streams.Shutdown()
|
||||
if alreadyInProgress {
|
||||
return done
|
||||
}
|
||||
r.sendGoAway(http2.ErrCodeNo)
|
||||
go func() {
|
||||
@@ -62,6 +64,7 @@ func (r *MuxReader) Shutdown() {
|
||||
<-done
|
||||
r.r.Close()
|
||||
}()
|
||||
return done
|
||||
}
|
||||
|
||||
func (r *MuxReader) run(parentLogger *log.Entry) error {
|
||||
|
Reference in New Issue
Block a user