TUN-2651: Fix panic in h2mux reader when a stream error is encountered

This commit is contained in:
Nick Vollmar 2020-01-30 19:00:01 -06:00
parent 386b02355a
commit 54b386188a
1 changed files with 6 additions and 1 deletions

View File

@ -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)