This repository has been archived by the owner on Jul 21, 2023. It is now read-only.
fix: improve resiliency of internals _send #84
Merged
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.
The js-libp2p tests exposed an issue with the latest libp2p-mplex, where because
Multiplex._send()
is potentially doing 2 pushes, we can get into a bad state wherereadable.push()
returns false, but we still have data to give. This could result in streams not closing properly, which was happening in the libp2p tests that exposed the issue.This PR concatenates the varint and data pushes (if there is data) into a single push. This avoids the scenario of there being residual data to send when
.push
returns false.You can see the passing build of libp2p using this branch here: https://ci.ipfs.team/blue/organizations/jenkins/libp2p%2Fjs-libp2p/detail/test%2Fgoodbye-mplex/2/pipeline