TUN-2608: h2mux.Muxer.Shutdown always returns a non-nil channel

This commit is contained in:
Nick Vollmar
2019-12-03 15:01:28 -06:00
parent bbf31377c2
commit b499c0fdba
6 changed files with 188 additions and 29 deletions

View File

@@ -353,9 +353,11 @@ func (m *Muxer) Serve(ctx context.Context) error {
}
// Shutdown is called to initiate the "happy path" of muxer termination.
func (m *Muxer) Shutdown() {
// It blocks new streams from being created.
// It returns a channel that is closed when the last stream has been closed.
func (m *Muxer) Shutdown() <-chan struct{} {
m.explicitShutdown.Fuse(true)
m.muxReader.Shutdown()
return m.muxReader.Shutdown()
}
// IsUnexpectedTunnelError identifies errors that are expected when shutting down the h2mux tunnel.