fix: cleanup open streams on conn close (#791)

This commit is contained in:
Jacob Heun 2020-10-23 15:34:59 +02:00 committed by GitHub
parent 8879634363
commit 06f26e586f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -306,7 +306,13 @@ class Upgrader {
}, },
newStream: newStream || errConnectionNotMultiplexed, newStream: newStream || errConnectionNotMultiplexed,
getStreams: () => muxer ? muxer.streams : errConnectionNotMultiplexed, getStreams: () => muxer ? muxer.streams : errConnectionNotMultiplexed,
close: (err) => maConn.close(err) close: async (err) => {
await maConn.close(err)
// Ensure remaining streams are aborted
if (muxer) {
muxer.streams.map(stream => stream.abort(err))
}
}
}) })
this.onConnection(connection) this.onConnection(connection)