Skip to content

Commit

Permalink
fix: always negotiateFully to ensure streams are usuable when ready
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-pousette committed Oct 28, 2024
1 parent 56ea8ee commit 81d59ee
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/transport/stream/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,11 @@ export abstract class DirectStream<
}

try {
stream = await connection.newStream(this.multicodecs);
stream = await connection.newStream(this.multicodecs, {
// TODO this property seems necessary, together with waitFor isReadable when making sure two peers are conencted before talking.
// research whether we can do without this so we can push data without beeing able to send
negotiateFully: true,
});
if (stream.protocol == null) {
stream.abort(new Error("Stream was not multiplexed"));
return;
Expand Down Expand Up @@ -2015,7 +2019,7 @@ export abstract class DirectStream<
try {
let checkIsWritable = (pDefer: DeferredPromise<void>) => {
// Dont wait for readlable https://github.com/libp2p/js-libp2p/issues/2321
if (/* stream.isReadable && */ stream.isWritable) {
if (stream.isReadable && stream.isWritable) {
pDefer.resolve();
}
};
Expand Down

0 comments on commit 81d59ee

Please sign in to comment.