Skip to content

Commit 7295b96

Browse files
author
Marcus Pousette
committed
fix: always negotiateFully to ensure streams are usuable when ready
1 parent 56ea8ee commit 7295b96

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/transport/stream/src/index.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,12 @@ export abstract class DirectStream<
792792
}
793793

794794
try {
795-
stream = await connection.newStream(this.multicodecs);
795+
stream = await connection.newStream(this.multicodecs, {
796+
// TODO this property seems necessary, together with waitFor isReadable when making sure two peers are conencted before talking.
797+
// research whether we can do without this so we can push data without beeing able to send
798+
// more info here https://github.com/libp2p/js-libp2p/issues/2321
799+
negotiateFully: true,
800+
});
796801
if (stream.protocol == null) {
797802
stream.abort(new Error("Stream was not multiplexed"));
798803
return;
@@ -2014,8 +2019,7 @@ export abstract class DirectStream<
20142019
const stream = this.peers.get(hash)!;
20152020
try {
20162021
let checkIsWritable = (pDefer: DeferredPromise<void>) => {
2017-
// Dont wait for readlable https://github.com/libp2p/js-libp2p/issues/2321
2018-
if (/* stream.isReadable && */ stream.isWritable) {
2022+
if (stream.isReadable && stream.isWritable) {
20192023
pDefer.resolve();
20202024
}
20212025
};

0 commit comments

Comments
 (0)