Skip to content

Commit

Permalink
fix: cleanup open streams on conn close (#791)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobheun authored Oct 23, 2020
1 parent 8879634 commit 06f26e5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/upgrader.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,13 @@ class Upgrader {
},
newStream: newStream || 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)
Expand Down

0 comments on commit 06f26e5

Please sign in to comment.