From 54b386188a8bc9643e8b8db293943dfbfeeabba9 Mon Sep 17 00:00:00 2001 From: Nick Vollmar Date: Thu, 30 Jan 2020 19:00:01 -0600 Subject: [PATCH] TUN-2651: Fix panic in h2mux reader when a stream error is encountered --- h2mux/muxreader.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/h2mux/muxreader.go b/h2mux/muxreader.go index c9b4dff7..f0efab63 100644 --- a/h2mux/muxreader.go +++ b/h2mux/muxreader.go @@ -97,7 +97,12 @@ func (r *MuxReader) run(parentLogger *log.Entry) error { switch e := err.(type) { case http2.StreamError: errLogger.Warn("stream error") - r.streamError(e.StreamID, e.Code) + // Ideally we wouldn't return here, since that aborts the muxer. + // We should communicate the error to the relevant MuxedStream + // data structure, so that callers of MuxedStream.Read() and + // MuxedStream.Write() would see it. Then we could `continue` + // and keep the muxer going. + return r.streamError(e.StreamID, e.Code) case http2.ConnectionError: errLogger.Warn("connection error") return r.connectionError(err)