fix: close muxed streams when underlying socket is closed #32
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi all!
We've been updating our libp2p-multiplex wrap (exposing pull-streams instead of Node.js streams and conforming with the interface defined on https://github.com/libp2p/interface-stream-muxer) and found that one of our expectations that is met with
spdy-transport
, wasn't met withmultiplex
, that is:'when the underlying socket is closed, every stream should be closed as well'.
This PR changes multiplex so that it does that.
In addition to this, we learned that now multiplex also passes our 'mega stress test', which previously would make multiplex error with OOM thrown.
I've added a test for this new behaviour. One Caveat is that now, since errors are propagated, you have to listen for errors on each stream, otherwise they will be process unCaught exceptions, I've updated the test 'overflow' because of this.